**Subject:** Re: accuracy of "long double"

**To:** None *<10.50@free.fr>*

**From:** Neil Booth *<neil@daikokuya.co.uk>*

**List:** port-amd64

**Date:** 08/30/2007 07:29:34
10.50@free.fr wrote:-
>> Yes, no, yes. :) Rounding for all FP arithmetic is to double precision
>> by default.
>
> That's still (partially) unclear. You mean that, if I add two
> <long double>s and put the result in a <long double>, I won't
> get the extra precision I expect in the result because it will
> be truncated to (normal) <double> precision ?
Yes. You can test this yourself of course:
#include <float.h>
volatile double y = DBL_EPSILON;
volatile long double z = LDBL_EPSILON;
int main (void)
{
return (z > 0 && z + 1 == 1
&& y > 0 && y + 1 != 1);
}
For me on NetBSD main returns 1. Which makes me wonder whether
the definition of LDBL_EPSION on x86 NetBSD is wrong - shouldn't
it be the same as DBL_EPSILON on x86 NetBSD?
> If yes, I don't see the point of keeping <long double>
> different from <double>?
Well, you do get greater exponent range. But don't ask me,
it wasn't my decision.
Neil.