|
Boost : |
From: Greg Chicares (chicares_at_[hidden])
Date: 2001-05-22 07:30:33
Jens Maurer wrote:
>
> Greg Chicares wrote:
> > 1. This patch comments out the NaN equality comparisons and moves them
> > under the "arithmetic traps" comment that precedes the commented-out
> > NaN inequality comparisons.
>
> QNaNs are *guaranteed* not to raise FP exceptions when compared
> for equality, according to IEEE. That's why they're called "quiet",
> after all.
I agree with this and all your other comments.
Changing the subject...would a C++ analog of C99's <fenv.h> be desirable
to discuss here? Are the standards committees working on this? (I spent
an hour browsing archives of comp.std.c++ but found no indication of
a definitive policy.)
Motivating examples
Discussion above in the context of limits_test.cpp shows that the
borland compiler (and perhaps others?) treat quiet NaNs as signaling.
This affects proposed numerical libraries such as matrices. Such
problems can be cured, but only by accessing the floating-point
hardware, and standard C++ can't do that yet.
For some ideas in the Fixed-Point Decimal thread, it would be useful
to have rint() and some means for control over rounding mode.
Perhaps C++ should exactly copy C99's IEC 60559 arithmetic approach;
but if not, then the standards committee might like to see an
alternative. For example, even with type-generic macros, C99 leaves
us with three distinct functions rint, lrint, and llrint, where one
template might suffice in C++. Maybe a single template should even
replace the rint, round, nearbyint, ceil, and trunc functions.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk