ccl
ccl copied to clipboard
Asserting the type of NaN signals an error
On macOS using CCL Version 1.12.1 DarwinX8664
CL-USER> (typep 1d+-0 'double-float)
T
CL-USER> (the double-float 1d+-0)
; Evaluation aborted on #<FLOATING-POINT-INVALID-OPERATION #x302001351E0D>.
Same bug on Linux x86-64.
We end up calling zerop on the NaN value as part of turning the typespec into a ctype.
https://github.com/Clozure/ccl/blob/273dc1909889639fb32b592c0982983c8731beac/level-1/l1-typesys.lisp#L3062-L3075
To be honest, I am not sure what to do here.
Probably use ccl::nan-or-infinity-p
to prevent zerop
been called on nan.
However, zerop
seems should not raise invalid operation exception on NaN at all, for the reason that compare quiet NaN with zero should just give false without signaling, but I'm not able to understand the assembly code to find out why the exception is raised for =
with two double floats.