enable dtoa tests on win32

This commit is contained in:
Fabrice Bellard 2025-03-22 12:40:37 +01:00
parent d1bb520f29
commit a44011ed5a

View File

@ -381,11 +381,9 @@ function test_number()
assert(Number.isNaN(Number("-"))); assert(Number.isNaN(Number("-")));
assert(Number.isNaN(Number("\x00a"))); assert(Number.isNaN(Number("\x00a")));
// TODO: Fix rounding errors on Windows/Cygwin. assert((1-2**-53).toString(12), "0.bbbbbbbbbbbbbba");
if (typeof os !== 'undefined' && ['win32', 'cygwin'].includes(os.platform)) { assert((1000000000000000128).toString(), "1000000000000000100");
return; assert((1000000000000000128).toFixed(0), "1000000000000000128");
}
assert((25).toExponential(0), "3e+1"); assert((25).toExponential(0), "3e+1");
assert((-25).toExponential(0), "-3e+1"); assert((-25).toExponential(0), "-3e+1");
assert((2.5).toPrecision(1), "3"); assert((2.5).toPrecision(1), "3");
@ -393,6 +391,8 @@ function test_number()
assert((25).toPrecision(1) === "3e+1"); assert((25).toPrecision(1) === "3e+1");
assert((1.125).toFixed(2), "1.13"); assert((1.125).toFixed(2), "1.13");
assert((-1.125).toFixed(2), "-1.13"); assert((-1.125).toFixed(2), "-1.13");
assert((0.5).toFixed(0), "1");
assert((-0.5).toFixed(0), "-1");
assert((1.3).toString(7), "1.2046204620462046205"); assert((1.3).toString(7), "1.2046204620462046205");
assert((1.3).toString(35), "1.ahhhhhhhhhm"); assert((1.3).toString(35), "1.ahhhhhhhhhm");