Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-05-21 12:34:18


Greg Chicares wrote:
> Patches 1 and 2 below probably take care of most of the win32 problems;
> I've only tested them with gcc and borland, though. Additional ideas
> below should help several compilers on other platforms pass this test.

Thanks for looking into this.

> 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'm willing to make most of the limits_test.cpp file
dependent on is_iec559, with a clear message stating this.

However, I'm unwilling to simply remove the NaN tests, because
if they fail, you indeed have a problem with your compiler. While
you may argue that we're not testing the compiler here, we in
fact do, because <limits> heavily depends on the compiler getting
its IEEE maths right. Other tests fail on some platforms as well
because the relevant compiler is broken. Such is life.

Aren't there any "strict IEEE" flags on Windows? Nearly every
Unix compiler appears to have these.

> 2. This patch removes other code that raises hardware exceptions
> with the borland compiler (and perhaps others). That compiler sets up
> the floating point hardware to abend on many operations with quiet
> NaNs, and of course it likes signaling NaNs even less.

Then the Borland compiler should be fixed, and until then failure
for the test is acceptable. I believe this is a serious defect
in the Borland compiler.

> 3. It appears that these linux targets
> Comeau C++ 4.2.45 beta2 libcomo beta7
> Comeau C++ 4.2.45 beta2 (strict mode) libcomo beta7
> might pass if these tests
> lim::infinity() > lim::max()
> -lim::infinity() < -lim::max()
> were suppressed. But this change doesn't seem like a very good idea.
> I can't guess why this is happening, but there's something similar
> going on with some other compilers:

Some <limits> files like to define infinity() to 0.

> 4.
> If a compiler doesn't claim
> conformance to IEC559, then maybe it shouldn't need to pass these
> tests.

That resolution I can live with.

Jens Maurer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk