bug in atof

Peter Beutner p.beutner at gmx.net
Sat Jan 21 10:31:05 CST 2006


Uwe Bonnes schrieb:
>>>>>> "Peter" == Peter Beutner <p.beutner at gmx.net> writes:
> 
> 
>     Peter> Which means that '7.8912654773d210' is the same as
>     Peter> '7.8912654773e210'.
> 
> Running the test with native msvcrt doesn't give me 7.8912654773e210
> neither...

Using the test that Louis posted in his first email ...

peter at lappy ~/coding $ /opt/xmingw/bin/i386-mingw32msvc-gcc -o test_atof.exe test_atof.c

peter at lappy ~/coding $ WINEDLLOVERRIDES=msvcrt=b  wine test_atof.exe
atof test: "  -2309.12E-15"; float:  -2.309120e-12
atof test: "7.8912654773d210"; float:  7.891265e+00
atoi test: "  -9885 pigs"; integer: -9885
atol test: "98854 dollars"; long: 98854

peter at lappy ~/coding $ WINEDLLOVERRIDES=msvcrt=n  wine test_atof.exe
atof test: "  -2309.12E-15"; float:  -2.309120e-012
atof test: "7.8912654773d210"; float:  7.891265e+210
atoi test: "  -9885 pigs"; integer: -9885
atol test: "98854 dollars"; long: 98854

So it works here as expected.

> 
>     Peter> But on linux we have(quoted from 'man strtod'): ----- A decimal
>     Peter> number consists of a nonempty sequence of decimal digits pos-
>     Peter> sibly containing a radix character (decimal point, locale
>     Peter> dependent, usually ``.''), optionally followed by a decimal
>     Peter> exponent.  A decimal exponent consists of an ``E'' or ``e'',
>     Peter> followed by an optional plus or minus sign, followed by a
>     Peter> non-empty sequence of decimal digits, and indicates
>     Peter> multiplication by a power of 10.  ----
> 
>     Peter> It doesn't parse 'd' or 'D' as exponent.  Seems to be a "MS-only
>     Peter> extension" to the standard :p
> 
> Could you please check  '7.8912654773d210' gives the expected result on
> windows?

Hmm don't have any installed windows around here atm.But isn't it enough that the native
msvcrt gives the expected result?



More information about the wine-devel mailing list