Re: (flexpt +nan.0 0.0) and (flexpt +1.0 +nan.0)
Bradley Lucier 10 Oct 2026 01:53 UTC
On 10/9/26 21:38, Peter McGoron wrote:
> 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.
This is an example of the secondary rule: If a function would give the
same answer for all non-NaN arguments, it should give the same result
for NaN arguments.
For a perhaps less controversial example of this rule, if one argument
of flhypot is an infinity, the result is +inf.0, even if the other
argument is a NaN.
As for the general question, I think each floating-point procedure
should assume that its input values are precisely given, and the
procedure should make best effort to return a possibly inaccurate, but
reasonable, result.
On top of this basis one can build (part of) the Scheme numeric tower.
Brad