added new dtoa library to print and parse float64 numbers. It is necessary to fix corner cases (e.g. radix != 10) and to have correct behavior regardless of the libc implementation.

This commit is contained in:
Fabrice Bellard
2025-03-19 19:07:57 +01:00
parent 9f1864a268
commit 993660621a
5 changed files with 1779 additions and 416 deletions

View File

@@ -390,8 +390,12 @@ function test_number()
assert((-25).toExponential(0), "-3e+1");
assert((2.5).toPrecision(1), "3");
assert((-2.5).toPrecision(1), "-3");
assert((25).toPrecision(1) === "3e+1");
assert((1.125).toFixed(2), "1.13");
assert((-1.125).toFixed(2), "-1.13");
assert((1.3).toString(7), "1.2046204620462046205");
assert((1.3).toString(35), "1.ahhhhhhhhhm");
}
function test_eval2()