ccl icon indicating copy to clipboard operation
ccl copied to clipboard

Asserting the type of NaN signals an error

Open eliaslfox opened this issue 2 years ago • 3 comments

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>.

eliaslfox avatar Feb 14 '23 00:02 eliaslfox

Same bug on Linux x86-64.

galdor avatar Feb 22 '23 20:02 galdor

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.

xrme avatar May 18 '24 07:05 xrme

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.

LdBeth avatar Jul 03 '24 18:07 LdBeth