[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ambiguous sign notation support?

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



Paul Schlie wrote:
> Any possibility of considering a somewhat more numerically
> consistent abstract notation for ambiguously signed values?
> 
> (i.e. ~nan.0 replaces the positively signed +nan.0 notation)
> 
> Thereby enabling the optionally supported designations:
> 
> ~inf.0                                             ~inf.0
> -inf.0                  -0.0 0 +0.0                +inf.0
>    <|------------------------|-----------------------|>
>    <--------- -nan.0 -------> <-------- +nan.0 ------->
>    <---------------------- ~nan.0 -------------------->

This is an interesting question.  The IEEE-754 standard
does not mandate *any* means for determining the sign of
a NaN, but recommends a CopySign function that could be
used for that purpose.

> (/ -0.0)    => -inf.0
> 
> (/ 0)       => ~inf.0 (or basic ~nan.0)
> 
> (/ +0.0)    => +inf.0
> 
> (/ -inf.0 +0.0) => -nan.0 (or basic ~nan.0)
> 
> (/ ~inf.0 +0.0) => ~nan.0
> 
> (/ +inf.0 +0.0) => +nan.0 (or basic ~nan.0)
> 
> Enabling a basic implementation to simply map:
> 
>   ~inf.0 -nan.0 +nan.0 => ~nan.0

SRFI 77 does not require all NaNs to print as +nan.0.
In fact, I don't believe SRFI 77 forbids any of the
NaNs you wrote above to print as ~nan.0.  In that
sense, I believe SRFI 77 already allows the extension
you desire.

The extension you desire should not be mandated,
however, because the IEEE standards explicitly allow
a very large variety of encodings for the NaN values
they specify.

Will