guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 10/10: Fix type/range inference for mul


From: Andy Wingo
Subject: [Guile-commits] 10/10: Fix type/range inference for mul
Date: Thu, 16 Jul 2015 08:06:32 +0000

wingo pushed a commit to branch master
in repository guile.

commit 90aabcc56556c09a65e4257630b10589aab2d3dd
Author: Andy Wingo <address@hidden>
Date:   Thu Jul 16 09:58:59 2015 +0200

    Fix type/range inference for mul
    
    * module/language/cps2/types.scm (mul): Fix nan testing.
---
 module/language/cps2/types.scm |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/module/language/cps2/types.scm b/module/language/cps2/types.scm
index 6fca57d..07da3d6 100644
--- a/module/language/cps2/types.scm
+++ b/module/language/cps2/types.scm
@@ -833,16 +833,17 @@ minimum, and maximum."
 (define-simple-type-checker (mul &number &number))
 (define-type-inferrer (mul a b result)
   (let ((min-a (&min a)) (max-a (&max a))
-        (min-b (&min b)) (max-b (&max b)))
+        (min-b (&min b)) (max-b (&max b))
+        ;; We only really get +inf.0 at runtime for flonums and
+        ;; compnums.  If we have inferred that the arguments are not
+        ;; flonums and not compnums, then the result of (* +inf.0 0) at
+        ;; range inference time is 0 and not +nan.0.
+        (nan-impossible? (not (logtest (logior (&type a) (&type b))
+                                       (logior &flonum &complex)))))
     (define (nan* a b)
-      ;; We only really get +inf.0 at runtime for flonums and compnums.
-      ;; If we have inferred that the arguments are not flonums and not
-      ;; compnums, then the result of (* +inf.0 0) at range inference
-      ;; time is 0 and not +nan.0.
       (if (and (or (and (inf? a) (zero? b))
                    (and (zero? a) (inf? b)))
-               (not (logtest (logior (&type a) (&type b))
-                             (logior &flonum &complex))))
+               nan-impossible?)
           0 
           (* a b)))
     (let ((-- (nan* min-a min-b))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]