Skip to content

Commit f22b827

Browse files
jiangjiekesaghul
authored andcommitted
Add n_digits=101 precision boundary tests
Addresses dtoa.c TODO item: 'test n_digits=101 instead of 100'
1 parent 917d608 commit f22b827

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

dtoa.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
/*
3939
TODO:
40-
- test n_digits=101 instead of 100
4140
- simplify subnormal handling
4241
- reduce max memory usage
4342
- free format: could add shortcut if exact result

tests/test_builtin.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,15 @@ function test_number()
442442

443443
assert((1.3).toString(7), "1.2046204620462046205");
444444
assert((1.3).toString(35), "1.ahhhhhhhhhm");
445+
446+
assert((123.456).toExponential(100),
447+
"1.2345600000000000306954461848363280296325683593750000000000000000000000000000000000000000000000000000e+2");
448+
assert((1.23e-99).toExponential(100),
449+
"1.2299999999999999636794326616259654935901564299639709630577493044757187515388707554223010856511630028e-99");
450+
assert((-0.0007).toExponential(100),
451+
"-6.9999999999999999288763374849509091291110962629318237304687500000000000000000000000000000000000000000e-4");
452+
assert((0).toExponential(100),
453+
"0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0");
445454
}
446455

447456
function test_eval2()

0 commit comments

Comments
 (0)