emacs-devel
[Top][All Lists]
Advanced

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

Re: bignum branch


From: Tom Tromey
Subject: Re: bignum branch
Date: Sat, 04 Aug 2018 10:33:27 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux)

>>>>> "Achim" == Achim Gratz <address@hidden> writes:

Achim> Tom Tromey writes:
Paul> min and max propagate any NaNs they find.
>> 
>> This part I don't understand, since my mental mode of min/max is that
>> they are iteratively applying < or >

Achim> The point of having NaN at all is to set aside a tiny bit of the symbol
Achim> space for floating point numbers to encode certain error conditions and
Achim> propagate them in-band.  Otherwise they'd need to be signalled via side
Achim> channels like traps and exceptions, which usually significantly slow
Achim> down the error-free cases also or complicate the code even further.
Achim> Getting an NaN indicates that your computation has left the domain it
Achim> was defined in.  So no matter what you do, after you get an NaN this
Achim> indication must be preserved, hence all results must propagate NaN until
Achim> you get to the point where you do error handling.

Yes, I understand.  What specifically is weird about this situation, for
me, is that min and max aren't like arithemetic operations like + or -.
And, the naive approach to writing min or max would not always
(depending on argument ordering) preserve NaN, because min and max,
presumably, are defined in terms of comparisons -- which always return
false with NaN.

Anyway, no big deal, it's easy to preserve these semantics with bignum
as well.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]