(flexpt +nan.0 0.0) and (flexpt +1.0 +nan.0)
Peter McGoron 10 Oct 2026 01:38 UTC
Under IEEE 754-2019 rules:
(flexpt +nan.0 0.0) ⇒ 1.0
(flexpt 1.0 +nan.0) ⇒ 1.0
I was under the impression that some Scheme implementations returned NaN
for these, but I tested CHICKEN, Gambit, Gauche, MIT-Scheme, and Chez
and they all return the IEEE specified values.
Currently in the SRFI, these cases can be 1.0 or they can be NaN.
Should the SRFI mandate the IEEE rule here or give some leeway? I find
it a little odd that an inexact operation on NaNs give a value here: if
you think of 0.0 or 1.0 here as only approximations, then these
evaluations don't make sense. (In IEEE-754, each number *is* precisely
that number. There is no differentiation between exact and inexact
numbers.) However, there might be a good reason for keeping it.
-- Peter McGoron