This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ optimization issue??
- From: Robert Dewar <dewar at adacore dot com>
- To: Dave Korn <dave dot korn at artimi dot com>
- Cc: 'ColinLaney' <claney at online dot de>, gcc at gcc dot gnu dot org
- Date: Fri, 17 Dec 2004 08:24:29 -0500
- Subject: Re: g++ optimization issue??
- References: <NUTMEGZpmM4E4RnpnaK00000855@NUTMEG.CAM.ARTIMI.COM>
Dave Korn wrote:
Because it isn't possible? FP is not real mathematics over the rational
number field, it is a finite approximation. If you really want absolute
precision and accuracy, you need to use a proper arbitrary-precision bignum
library, such as GMP.
Well that could be a little misleading. Floating-point is not some murky
approximation of real arithmetic on a modern IEEE compatible system. The
results of IEEE arithmetic are after all extremely well defined, just as
well defined as real arithmetic.
The issue in cases like this is how the language maps into IEEE operations,
and there are two questions:
1. What do users expect in practice
2. What does the standard require
Users clearly don't expect extended precision effects (indeed Kahan
complained that extra precision in a Fortran compiler was a plain
bug, and I remember discussing this issue with him, and he was simply
unwilling to accept that the Fortran standard permitted the clearly
"wrong" behavior he was seeing.
Standards have only just started to address the issue clearly (the
IEEE standard itself does not have to say much about this mapping).