1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 20:35:04 +00:00

Fix NaN toNumber

This commit is contained in:
Michael Mclaughlin
2014-05-08 19:27:25 +01:00
parent ba0ca1ee14
commit 800cef4c1f
3 changed files with 10 additions and 8 deletions

View File

@@ -1452,7 +1452,7 @@
var x = this;
// Ensure zero has correct sign.
return +x || ( x | 0 ) * x['s'];
return +x || ( x['s'] ? 0 * x['s'] : NaN );
};
@@ -2545,7 +2545,7 @@
return x;
}
// Remove any digits after the required decimal places.
// Truncate excess digits.
if ( xc.length > sd ) {
xc.length = sd;
}