On an Arm9 processor running Debian the following program gives the results
indicated...
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
 double in, out;
 in = 2.0;
 out = sqrt(in);
 printf("%f\n", out);       // 2.0000
 printf("%f\n", sqrt(in));  // 1.414214
 printf("%f\n", sqrt(2.0)); // 1.414214
 return 0;
}

It works for most values but some obvious ones, all of which seem to be powers
of two, fail though not all powers of two.

This also seems to affect other floating point operations.


-- 
           Summary: Floating point errors on Arm9 processor
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mp2 at ladybridge dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39085

Reply via email to