This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: abs / magnitude


On Wed, 10 May 2000, Dirk Herrmann wrote:

> Hello!
> 
> Guile defines abs as magnitude.  But, is it allowed to call abs on complex
> numbers?


R5RS about abs:
`Abs' returns the absolute value of its argument.

R5RS about magnitude:
These procedures are part of every implementation that supports general
complex numbers. Suppose x1, x2, x3, and x4 are real numbers and z is a
complex number such that z = x1 + x2i = x3 . e^i x4.  Then [...]
(magnitude z) ==> |x3|
[...]
Rationale: `Magnitude' is the same as abs for a real argument, but `abs'
must be present in all implementations, whereas `magnitude' need only
be present in implementations that support general complex numbers. 


I interpret this as if complex arguments for 'abs' are not allowed.  If
nobody objects I will just remove the line (set! abs magnitude) from
boot-9.scm.

Best regards
Dirk Herrmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]