[Bug c/56399] New: Adding int to float generates incorrect results

johnfoxrep at yahoo dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 19 17:10:00 GMT 2013


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

             Bug #: 56399
           Summary: Adding int to float generates incorrect results
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: johnfoxrep@yahoo.com


The following program demonstrates the bug. Tested with 32-bit GCC 4.7.2.

#include <stdio.h>
void main()
{
        int x = 1073760000;
        float f = 120000;
        f += x;
        printf("expected:%d\ncomputed:%f\n", x + 120000, f);
}



More information about the Gcc-bugs mailing list