bug in atof
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sat Jan 21 08:15:02 CST 2006
>>>>> "Louis" == Louis Lenders <xerox_xerox2000 at yahoo.co.uk> writes:
Louis> Hi, i filed a bug ( bug 4337) and looks like there's a bug in
Louis> atof. Is there a difference between linux' atof and msvcrt's one?
Louis> Even following simple program (from msdn) yields wrong results:
Louis> // crt_atof.c #include <stdlib.h> #include <stdio.h>
Louis> int main( void ) { char *s; double x; int i; long l;
Louis> s = " -2309.12E-15"; /* Test of atof */ x = atof( s ); printf(
Louis> "atof test: \"%s\"; float: %e\n", s, x );
Louis> s = "7.8912654773d210"; /* Test of atof */ x = atof( s );
Louis> printf( "atof test: \"%s\"; float: %e\n", s, x );
Louis> s = " -9885 pigs"; /* Test of atoi */ i = atoi( s ); printf(
Louis> "atoi test: \"%s\"; integer: %d\n", s, i );
Louis> s = "98854 dollars"; /* Test of atol */ l = atol( s ); printf(
Louis> "atol test: \"%s\"; long: %ld\n", s, l ); } the exponent value in
Louis> float x are wrong. Thanks
Not atof() is the cause of your bug, but printf().
I entered your sample into the test suite to show the correct behaviour of
wine's implementation of atof. The printf() test has already a todo for the
incorrect exponent output.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the wine-devel
mailing list