Subject: Re: accuracy of "long double"
To: Matthias Drochner <M.Drochner@fz-juelich.de>
From: Neil Booth <neil@daikokuya.co.uk>
List: port-amd64
Date: 08/18/2007 10:23:27
Matthias Drochner wrote:-

> 
> Inspired by a selftest failure of sqlite3, I tried to
> understand how "long double" math is supposed to work
> if the FPU is set to 53-bit rounding.
> My findings are posted as PR port-i386/36770 and a reply.
> 
> Before I take further steps (like the gcc configuration
> change mentioned there) I'd like to get a second opinion.
> 
> Could someone understanding the matter have a look at
> that PR and tell whether I'm correct?
> 
> thanks & best regards
> Matthias

My understanding of operating in 53-bit mode is the following:

a) Loads from memory are still done in full precision and not
   truncated.
b) Exponents have a wider range, so overflows or underflows that
   would happen on doubles don't necessarily happen on long
   doubles.
c) For both the above reasons, long double ops are not equivalent
   to double ops.
d) Despite many claims to the contrary that you will read on the
   net, and on GCC lists, there is no double-rounding problem.
   All results are correctly rounded to 53-bits given the value
   they operated on (which may have had the full precision owing
   to a)).

HTH,

Neil.