Subject: Re: accuracy of "long double"
To: Matthias Drochner <>
From: Neil Booth <>
List: tech-toolchain
Date: 08/21/2007 07:45:59
Matthias Drochner wrote:-

> The famous "paranoia" test program finds a number of rounding
> flaws eg on Linux. I've extracted the failing tests for
> multiplication - see attachment.

Linux uses extended precision by default, so that's as expected.
The tests you posted are for *double* arithmetic, not long

> The tests succeed on NetBSD. If I set the FPCW to its initial
> value, ie 64-bit rounding (by enabling the "#if 0" part),
> the tests fail. With -mfpmath=sse, the tests succeed.
> So doubles are still not rounded correctly if the FPU is used
> in extended precision mode.

NetBSD by default uses double precision rounding, so the pass is
as expected.

Your #if 0 code enables *double extended precision*, from what I
can see from my CPU docs, so its failure is also expected.  I've
added a couple of comments below.

I'm afraid I don't see your point; your code seems to support
everything I said.


// This constant is double-extended precision mode
// Double precision mode would be 0x27f, which passes.
>         const int fpcw = 0x37f;