Re: Fw: Useless sNaNs... or useful?
On 2010-10-15 14:25:31 -0400, Ian McIntosh wrote:
> One important use is to initialize all floating point variables to
> signaling NaNs.
I completely agree (note that MPFR initializes all its variables
to NaN -- MPFR currently supports only one kind of NaN, with a
behavior between qNaN and sNaN). But I doubt the behavior will
change in C, as this will break many correct programs (where in
short, static data are initialized to the semantic value 0), and
less correct ones, that assume that this is equivalent to have a
memory representation with all bits to 0. I don't know about the
other languages...
> Another complication with that transformation is that some non-754
> compliant systems round some values down when they're used or copied or
^^^^ not necessarily down
> stored, so
> x = y+0; if (x != y) then maybe it's a NaN or maybe x just got
> rounded down and y didn't
> can be the surprise.
Actually that was a problem with the old IEEE 754-1985 standard,
which didn't specify what a destination was (in C, such problems
are more due to non-C conformance).
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)