mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 13:01:42 -08:00
numlib: fix return value of signum for complex zero
This commit is contained in:
parent
c1c68bb4fe
commit
2b3f7bb1fd
1 changed files with 3 additions and 1 deletions
|
|
@ -127,7 +127,9 @@ Returns zero for non-complex numbers."
|
|||
Returns a number that represents the sign of NUMBER. Returns NUMBER If it is
|
||||
zero. Otherwise, returns the value of (/ NUMBER (ABS NUMBER))"
|
||||
(if (complexp x)
|
||||
(cis (atan (imagpart x) (realpart x)))
|
||||
(if (zerop x)
|
||||
x
|
||||
(cis (atan (imagpart x) (realpart x))))
|
||||
(let ((result (cond ((> x 0) 1)
|
||||
((< x 0) -1)
|
||||
(t ; x is 0 or NaN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue