[Git][cmucl/cmucl][issue-156-take-2-nan-comparison] Use existing function to compute >= and <=

Raymond Toy (@rtoy) gitlab at common-lisp.net
Wed Mar 8 15:56:34 UTC 2023



Raymond Toy pushed to branch issue-156-take-2-nan-comparison at cmucl / cmucl


Commits:
bd505bab by Raymond Toy at 2023-03-08T07:56:11-08:00
Use existing function to compute >= and <=

The code assumed if a0 >= b0 and a1 >= b1 implied a >= b for a
bigfloat.  But I forgot that 1.99999...w0 is represented as 2d0 and a
tiny negative number.  So `(<= 2w0 1.99999...w0)` would return false
because, while a0 <= b0, a1 <= b1 is false.

So for simplicity just use the obvious replacement that a <= b is the
same as a < b or a = b, which we already have.

[skip ci]

- - - - -


1 changed file:

- src/compiler/float-tran-dd.lisp


Changes:

=====================================
src/compiler/float-tran-dd.lisp
=====================================
@@ -670,13 +670,13 @@
 
 (declaim (inline dd<=))
 (defun dd<= (a0 a1 b0 b1)
-  (and (<= a0 b0)
-       (<= a1 b1)))
+  (or (dd> a0 a1 b0 b1)
+      (dd= a0 a1 b0 b1)))
 
 (declaim (inline dd>=))
 (defun dd>= (a0 a1 b0 b1)
-  (and (>= a0 b0)
-       (>= a1 b1)))
+  (or (dd> a0 a1 b0 b1)
+      (dd= a0 a1 b0 b1)))
 
 (deftransform = ((a b) (vm::double-double-float vm::double-double-float) *)
   `(dd= (kernel:double-double-hi a)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/bd505bab9b50e50016cea7c1207ceb06b86a1f22

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/bd505bab9b50e50016cea7c1207ceb06b86a1f22
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230308/d97b4cdb/attachment-0001.html>


More information about the cmucl-cvs mailing list