[cmucl-imp] [cmucl-help] NaN

Raymond Toy toy.raymond at gmail.com
Fri Jan 13 00:10:14 UTC 2017


>>>>> "Marco" == Marco Antoniotti <marcoxa at cs.nyu.edu> writes:

    Marco> However, as usual, the situation is messier that one knew.

    Marco> Consider this.

    Marco> CMUCL (and SBCL)

    CL-USER> (/ 0.0 0.0)
    Marco> ; Evaluation aborted on #<FLOATING-POINT-INVALID-OPERATION {48A20E2D}>.


    Marco> LW

    Marco> CL-USER 17 > (/ 0.0 0.0)
    Marco> Error: Division-by-zero caused by / of (0.0 0.0).


    Marco> Allegro

    Marco> CG-USER(1): (/ 0.0 0.0)
    Marco> Error: Division-by-zero


    Marco> CCL

    Marco> ? (/ 0.0 0.0)
    >> Error: FLOATING-POINT-INVALID-OPERATION detected
    >> performing / on (0.0 0.0)


    Marco> ABCL

    Marco> CL-USER(1): (/ 0.0 0.0)
    Marco> #<SINGLE-FLOAT NaN>


    Marco> So.  According to my understanding, the behavior of
    Marco> CMUCL/SBCL and CCL is “correct”.  The same could be said
    Marco> for ABCL.  LW and Allegro instead signal the wrong
    Marco> exception.

    Marco> What do you think?

I had to look this up.  The IEEE754 spec says 0/0 is an invalid
operation (sec 7.2, item d). So ccl, cmucl, and sbcl are ok.  abcl is
ok if exceptions are disabled.  I'm guessing LW and Allegro are
checking manually for division by 0 instead of just letting the
machine do the division and signaling there.  The nice thing about LW
and Allegro is that you don't have to go through a signal handler for
this.

--
Ray







More information about the cmucl-imp mailing list