This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: where to discuss problems with IEEE 754 standard on x86 architecture?
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Petr Savicky <savicky at cs dot cas dot cz>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 23 May 2007 09:45:55 +0100
- Subject: Re: where to discuss problems with IEEE 754 standard on x86 architecture?
- References: <20070522194435.GC29083@cs.cas.cz>
Petr Savicky writes:
> Can anybody help me to find the right place to discuss the problems
> related to IEEE 754 standard for floating point numbers on x86 (IA-32)?
>
> The following code
> #include <stdio.h>
>
> int main(int argc, char *argv[]) {
> double x,y,z,m=1.0;
> for (int i=0; i<52; i++) { m *= 2.0; }
>
> x = 1.5 - 1.0/4096.0 - 1.0/m;
> y = 1.5 - 1.0/4096.0;
>
> z = 1.0 + 1.0/m*x;
> printf("%f\n",m*(z-1.0));
>
> z = 1.0 + 1.0/m*y;
> printf("%f\n",m*(z-1.0));
> }
> produces output
> 1.000000
> 2.000000
> on x86 (IA-32) processor. In my opinion, this implies that IA-32 processor
> does not follow IEEE 754 exactly, since the closest representable
> value to both 1.0 + 1.0/m*x and 1.0 + 1.0/m*y is z = 1.0 + 1.0/m
> and not z = 1.0 + 2.0/m, which is obtained in the second case.
>
> Am I right? If yes, I think that the problem is known. Are there web
> pages or other resources on this problem?
Yes. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
Andrew.