This is the mail archive of the gcc-bugs@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]

[Bug c/25498] New: atof conversion error


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


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