Use real:abs, real:copysign.
authorTaylor R Campbell <campbell@mumble.net>
Sat, 1 Dec 2018 02:09:21 +0000 (02:09 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sat, 1 Dec 2018 02:09:21 +0000 (02:09 +0000)
These aren't guaranteed to be flonums here.

Mixed-exactness complex numbers are pretty silly.

src/runtime/arith.scm
tests/runtime/test-arith.scm

index 76aa51f88dba173160658bead21f9bf06e66e74b..160e6b7f657956814d60b241161c42cf20a264d7 100644 (file)
@@ -2022,16 +2022,16 @@ USA.
                  ;; Rotate from pi/2 to pi/4, or from -pi/2 to -pi/4,
                  ;; or preserve NaN but keep real sign positive.
                  (assert (or (real:infinite? y) (real:nan? y)))
-                 (complex:%make-rectangular (flo:abs y) y))
+                 (complex:%make-rectangular (real:abs y) y))
                 ((and (real:infinite? x) (real:finite? y))
                  (if (real:negative? x)
-                     (complex:%make-rectangular 0. (flo:copysign x y))
-                     (complex:%make-rectangular x (flo:copysign 0. y))))
+                     (complex:%make-rectangular 0. (real:copysign x y))
+                     (complex:%make-rectangular x (real:copysign 0. y))))
                 (else
                  ;; Garbage in, garbage out.  Try to preserve as much
                  ;; NaNity as possible.
                  (assert (or (real:nan? x) (real:nan? y)))
-                 (complex:%make-rectangular (flo:abs x) y)))))
+                 (complex:%make-rectangular (real:abs x) y)))))
        ((real:safe-negative? z)
         (complex:%make-rectangular 0 (x>=0 (real:negate z))))
        (else
index 025c5d4b67f2050a9727b6d0e4c16bc7020a25b6..f8a5cb6c9b0cdbd66ea8470592dfe58f50b6c9ba 100644 (file)
@@ -765,17 +765,17 @@ USA.
     (+inf.0+0.i +inf.0+0.i)
     (+inf.0+0i +inf.0+0i)
     (-inf.0+1.i 0.+inf.0i)
-    (-inf.0+1i 0.+inf.0i ,expect-error)
+    (-inf.0+1i 0.+inf.0i)
     (+inf.0+1.i +inf.0+0.i)
-    (+inf.0+1i +inf.0+0.i ,expect-error)
+    (+inf.0+1i +inf.0+0.i)
     (-inf.0-0.i 0.-inf.0i)
     (-inf.0-0i 0+inf.0i)                ;no exact signed zero
     (+inf.0-0.i +inf.0-0.i)
     (+inf.0-0i +inf.0-0i)
     (-inf.0-1.i 0.-inf.0i)
-    (-inf.0-1i 0.-inf.0i ,expect-error)
+    (-inf.0-1i 0.-inf.0i)
     (+inf.0-1.i +inf.0-0.i)
-    (+inf.0-1i +inf.0-0.i ,expect-error)
+    (+inf.0-1i +inf.0-0.i)
     (-inf.0i +inf.0-inf.0i)
     (+inf.0i +inf.0+inf.0i)
     (+0.-inf.0i +inf.0-inf.0i)