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/50695] double comparison broken after computation


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?


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