This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25498] New: atof conversion error
- From: "mike dot c at u-s-merchants dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2005 23:16:03 -0000
- Subject: [Bug c/25498] New: atof conversion error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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