Subject: Re: accuracy of "long double"
To: None <>
From: Neil Booth <>
List: tech-toolchain
Date: 08/29/2007 20:41:56 wrote:-

> Sorry for being still more inquisitive, I still have two further questions:
> 1. If I understand correctly, <long double> on NetBSD will NOT behave as IEEE
> 80-bit precision should do. Does it mean that <long double> = <double>, or just
> that the rounding prescriptions of <long double> are not honored?

Yes, no, yes.  :)  Rounding for all FP arithmetic is to double precision
by default.
> 2. If I compile the code with gcc -mfpmath=sse -msse2 [...] (as I usually do) do
> I get the right behaviour for <double> and <long double>?

I don't know enough about GCC's code generation, sorry.  If that
guarantees that SSE2 is used for doubles, then yes, but for long double
there is only the x87 FPU, right?  And that's in double precision mode
by default.  If you switch to long double precision then perhaps, if
GCC does all the correct stuff with FPU settings and mixing FPU units, yes.

> 3. Is there a penalty, in terms of performance, to incur by switching from
> default x86 <double> precision to full <long double> precision?

I don't believe so, there may even be a gain as it's the FPU's native
mode, but I'm not sure.