You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without float traps disabled comparing a value with NaN signals an error. With float traps disabled NaN values compare equal to themselves and other floats.
CL-USER> (ccl:set-fpu-mode :overflow nil :underflow nil :division-by-zero nil :invalid nil :inexact nil)
CL-USER> (= 1d+-0 1d+-0)
T
CL-USER> (= 1d+-0 1d)
T
CL-USER> (= 1d+-0 1f)
T
I looked at the disassembly for a function that compares floats:
(defunf (x y)
(declare (typedouble-float x y)
(optimize (speed3) (safety0)))
(= x y))
On CCL COMISD is used to compare the arguments for equality. CCL then checks the equality flag (ZF) but does not check for unordered comparisons.
I agree that CCL needs to be smarter here. We'll have to introduce some new vinsn (or other mechanism) that can emit code to check multiple flags. The x8664 vinsn cr-bit->boolean only checks one flag.
On macOS using CCL
Version 1.12.1 DarwinX8664
Without float traps disabled comparing a value with NaN signals an error. With float traps disabled NaN values compare equal to themselves and other floats.
I looked at the disassembly for a function that compares floats:
On CCL COMISD is used to compare the arguments for equality. CCL then checks the equality flag (ZF) but does not check for unordered comparisons.
For comparison, SBCL also uses COMISD but then it checks PF and ZF separately to handle unequal and unordered comparisons.
Also, CMOVE is called in CMOVEL throughout the CCL codebase. Is this intentional?
The text was updated successfully, but these errors were encountered: