From: Robert Ramey (ramey_at_[hidden])
Date: 2006-05-15 14:14:57
David Abrahams wrote:
> "Robert Ramey" <ramey_at_[hidden]> writes:
>> I think we should go in the opposite direction. A float is a
>> a legitmate floating point value. A union of float and some
>> other special non-floating point values is something else.
> Notwithstanding the fact that NaN is "not a number," it is a
> legitimate floating-point value, i.e. a legitimate value for the type
I guess it depends what one means by "legitimate". It is
is certainly "legal" in C++ - no question about that fact.
Its certainly not a number - no question about that either.
The problem is that C++ makes float a union of two
different things and that is what creates all the problems
we have with it. C++ should correct this by making
the result of arithmetic operations which result in Nan's
either undefined or throw exceptions. Oh I know that
this would break a lot of existing code. I would argue
that such code is already broken anyway - it just
looks like its working.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk