This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: where to discuss problems with IEEE 754 standard on x86 architecture?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]