[cmucl-imp] Fwd: [cmucl-help] NaN

Raymond Toy toy.raymond at gmail.com
Sun Jan 8 22:58:37 UTC 2017


Oops. Meant to reply to all.

---------- Forwarded message ----------
From: Raymond Toy <toy.raymond at gmail.com>
Date: Sun, Jan 8, 2017 at 10:00 AM
Subject: Re: [cmucl-help] NaN
To: Marco Antoniotti <marcoxa at cs.nyu.edu>




On Sat, Jan 7, 2017 at 3:44 PM, Marco Antoniotti <marcoxa at cs.nyu.edu> wrote:

> Hi
>
> I am fiddling around with some IEEE floating points.
>
> I see that the following code produces a (almost nice) “quiet” NaN.
>
> CL-USER> (ext:with-float-traps-masked (:invalid)
>            (* 0.0 ext:double-float-positive-infinity))
> #<DOUBLE-FLOAT Quiet NaN>
>
> Alas, there seem to be no way to tell the compiler that we are actually
> executing the multiplication within the ext:with-float-traps-masked.  This
> prevents us, for example to do things like
>
> (defparameter NAN (ext:with-float-traps-masked (:invalid)
>                     (* 0.0 ext:double-float-positive-infinity))
>
> in a file and having it compiled “nicely”.  The compiler complains (warns)
> about a FLOATING-POINT-INVALID-OPERATION
>
> ; In: DEFPARAMETER NAN
>
> ;   (* 0.0 EXTENSIONS:DOUBLE-FLOAT-POSITIVE-INFINITY)
> ; Warning: Lisp error during constant folding:
> ; Arithmetic error FLOATING-POINT-INVALID-OPERATION signalled.
> ; Operation was *, operands (0.0d0 #.EXT:DOUBLE-FLOAT-POSITIVE-INFINITY).
>

​What version? I don't get any warnings from snapshot-2017-01.​


>
> Note that the value is then assigned correctly, but it seems very hard (at
> least I did not figure out how to do it) to get to the constant folding
> time to catch and muffle the warning.
>
> Any ideas?
>

​Since you're using cmucl-specific functions, you could always just
construct the NaN directly using kernel:make-double-float.  Something like
(kernel:make-double-float -524288 0)​


-- 
Ray



-- 
Ray


More information about the cmucl-imp mailing list