char currConv[9];
        float currConvf;
        memset(currConv, '\0', sizeof(currConv));
        memcpy(currConv, '60342935', 8);
        currConv[8] = 0;
        currConvf = atof(currConv);

// currConvf gets assigned value of 60342936 when string 60342935 is converted
to float with atof
// if currConvf is declared type double instead of float, the value is assigned
 // correctly:  60342935  (try in debugger)
// Thanks.


-- 
           Summary: atof conversion error
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mike dot c at u-s-merchants dot com


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

Reply via email to