[PATCH v2] ucrtbase: Make the strtod implementation C99 compatible

Piotr Caban piotr.caban at gmail.com
Tue Sep 29 06:21:03 CDT 2015


On 09/21/15 15:08, Martin Storsjo wrote:
>           if(d>MSVCRT_UI64_MAX/10 || hlp<d) {
Please also update overflow checking rules (use base instead of 10).

> +static void test_strtod(void)
> +{
> +    test_strtod_str("infinity", INFINITY, 8);
> +    test_strtod_str("INFINITY", INFINITY, 8);
> +    test_strtod_str("InFiNiTy", INFINITY, 8);
> +    test_strtod_str("INF", INFINITY, 3);
> +    test_strtod_str("-inf", -INFINITY, 4);
> +    test_strtod_str("inf42", INFINITY, 3);
> +    test_strtod_str("inffoo", INFINITY, 3);
> +    test_strtod_str("infini", INFINITY, 3);
> +
> +    test_strtod_str("NAN", NAN, 3);
> +    test_strtod_str("nan", NAN, 3);
> +    test_strtod_str("NaN", NAN, 3);
> +
> +    test_strtod_str("0x42", 66, 4);
> +    test_strtod_str("0X42", 66, 4);
> +    test_strtod_str("-0x42", -66, 5);
> +    test_strtod_str("0x1p1", 2, 5);
> +    test_strtod_str("0x1P1", 2, 5);
> +    test_strtod_str("0x1p+1", 2, 6);
> +    test_strtod_str("0x2p-1", 1, 6);
> +    test_strtod_str("0xA", 10, 3);
> +    test_strtod_str("0xa", 10, 3);
> +    test_strtod_str("0xABCDEF", 11259375, 8);
> +    test_strtod_str("0Xabcdef", 11259375, 8);
> +
> +    test_strtod_str("0x1.1", 1.0625, 5);
> +    test_strtod_str("0x1.1p1", 2.125, 7);
Could you please also add few more tests, like:
test_strtod_str("0x1.A", ...); /*to show that part after decimal point 
is correctly handling hexadecimal digits */
test_strtod_str("0x1p1a", ...); /* to show that exponential part is not 
handling hexadecimal digits */

Thanks,
Piotr



More information about the wine-devel mailing list