cvs commit: src/sys/i386/include _types.h
cperciva at freebsd.org
Thu Mar 6 05:19:21 UTC 2008
David Schultz wrote:
> If gcc actually implemented IEEE 754R / C99 / LIA1 correctly, then
> when compiling something like 'double x = y' would require it to
> store the value to memory and then reload it to force it to 53-bit
Even this wouldn't work, since it would result in double rounding.
> The whole point of double_t is to allow the programmer
> to ask for a variable that is "at least double precision", so that
> the compiler isn't forced to clip everything to double precision
> if it's inefficient to do so.
Right -- and that's why numerical analysts should use double (after
proving that their code will produce the correct results using
double-precision arithmetic) while people who don't understand
floating-point math should always use double_t.
> However, gcc doesn't compile the above
> expression correctly, and FreeBSD works around the problem by
> setting the default rounding mode to 53 bits, which is why it's
> pointless to increase the size of double_t.
I disagee with your characterization of setting the rounding mode
as a "workaround", but your conclusion is correct: At the moment,
increasing the size of double_t is pointless.
More information about the cvs-src