This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50695] double comparison broken after computation
- From: "gpib at rickyrockrat dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 11 Oct 2011 19:05:28 +0000
- Subject: [Bug c/50695] double comparison broken after computation
- Auto-submitted: auto-generated
- References: <bug-50695-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50695
--- Comment #5 from rickyrockrat <gpib at rickyrockrat dot net> 2011-10-11 19:05:28 UTC ---
>+1.00000E-06," does not start with a valid
>floating point number and will always be parsed as 0.
I don't know what 'always will be', nor who exactly is doing the parsing, but
strtof, at least, seems to parse it correctly, because a print of said variable
prints as 1.00000E-06.... Believe me, I checked.
Ok, here's a new test case, still broken:
#include <string.h>
int main(int argc, char *argv){
double x,y;
x=strtod(",+1.00000E-06,",NULL);
y=1000;
y*=1000;
if(x*y!=1)
printf("Bug!!%E\n",x);
else printf("Nobug\n");}
And the output is:
Bug!!4.400000E+01
How is it resolved?