You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
565 B

/*===
2
===*/
/* Exercise a special string-to-number corner case: the mantissa generated
* is all 1s (53 + 1 digits of 1), and when the last digit is rounded, the
* carry will ripple over the initial digit. The exponent needs to be bumped
* by one. The final result is 2.
*/
try {
print(Number('1.99999999999999989'));
} catch (e) {
print(e);
}
/*===
Infinity
===*/
/* Same test, but the bump in exponent overflows the IEEE double range,
* yielding Infinity.
*/
try {
print(Number('1.79769313486231581e308'));
} catch (e) {
print(e);
}