| OLD | NEW |
| (Empty) |
| 1 This test checks a few Number.toPrecision cases, including 15145: (0.999).toPrec
ision(1) returns incorrect result. | |
| 2 | |
| 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
| 4 | |
| 5 | |
| 6 PASS (0.999).toPrecision(1) is "1" | |
| 7 PASS (0.999).toPrecision(2) is "1.0" | |
| 8 PASS (0.999).toPrecision(3) is "0.999" | |
| 9 PASS (0.0).toPrecision(4) is "0.000" | |
| 10 PASS (-0.0).toPrecision(4) is "0.000" | |
| 11 PASS (0.0).toPrecision() is "0" | |
| 12 PASS (-0.0).toPrecision() is "0" | |
| 13 PASS (1234.567).toPrecision() is "1234.567" | |
| 14 PASS (1234.567).toPrecision(0) threw exception RangeError: toPrecision() argumen
t must be between 1 and 21. | |
| 15 PASS (1234.567).toPrecision(null) threw exception RangeError: toPrecision() argu
ment must be between 1 and 21. | |
| 16 PASS (1234.567).toPrecision(false) threw exception RangeError: toPrecision() arg
ument must be between 1 and 21. | |
| 17 PASS (1234.567).toPrecision('foo') threw exception RangeError: toPrecision() arg
ument must be between 1 and 21. | |
| 18 PASS (1234.567).toPrecision(-1) threw exception RangeError: toPrecision() argume
nt must be between 1 and 21. | |
| 19 PASS (1234.567).toPrecision(1) is "1e+3" | |
| 20 PASS (1234.567).toPrecision(true) is "1e+3" | |
| 21 PASS (1234.567).toPrecision('1') is "1e+3" | |
| 22 PASS (1234.567).toPrecision(2) is "1.2e+3" | |
| 23 PASS (1234.567).toPrecision(2.9) is "1.2e+3" | |
| 24 PASS (1234.567).toPrecision(5) is "1234.6" | |
| 25 PASS (1234.567).toPrecision(21) is "1234.56700000000000728" | |
| 26 PASS (1234.567).toPrecision(22) threw exception RangeError: toPrecision() argume
nt must be between 1 and 21. | |
| 27 PASS (1234.567).toPrecision(100) threw exception RangeError: toPrecision() argum
ent must be between 1 and 21. | |
| 28 PASS (1234.567).toPrecision(101) threw exception RangeError: toPrecision() argum
ent must be between 1 and 21. | |
| 29 PASS (1234.567).toPrecision(posInf) threw exception RangeError: toPrecision() ar
gument must be between 1 and 21. | |
| 30 PASS (1234.567).toPrecision(negInf) threw exception RangeError: toPrecision() ar
gument must be between 1 and 21. | |
| 31 PASS (1234.567).toPrecision(nan) threw exception RangeError: toPrecision() argum
ent must be between 1 and 21. | |
| 32 PASS posInf.toPrecision() is "Infinity" | |
| 33 PASS negInf.toPrecision() is "-Infinity" | |
| 34 PASS nan.toPrecision() is "NaN" | |
| 35 PASS successfullyParsed is true | |
| 36 | |
| 37 TEST COMPLETE | |
| 38 | |
| OLD | NEW |