diff options
author | max99x <max99x@gmail.com> | 2011-06-27 21:23:46 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-06-27 21:23:46 +0300 |
commit | a0ac176b22bbcf252dff23b89583bb077fafe371 (patch) | |
tree | 6678fb29fe1190b33aa0339d5d16c1e5163ea889 /src | |
parent | bb908423d386f5f28e452b301daa3fb758707de1 (diff) |
Fixed some strict mode problems; added test for -Infinity.
Diffstat (limited to 'src')
-rw-r--r-- | src/library.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js index 8a0b4993..a9f7c14a 100644 --- a/src/library.js +++ b/src/library.js @@ -286,7 +286,7 @@ var Library = { // Normalize it so wholePart is one digit. if (wholePart == '0') { - while (fractionPart[0] == '0') { + while (fractionPart.length && fractionPart[0] == '0') { exponent--; fractionPart = fractionPart.slice(1); } @@ -332,8 +332,8 @@ var Library = { fractionPart += '0'; } } - if (fractionPart.length && dropTrailingZeros) { - while (fractionPart[fractionPart.length - 1] == '0') { + if (dropTrailingZeros) { + while (fractionPart.length && fractionPart[fractionPart.length - 1] == '0') { fractionPart = fractionPart.slice(0, -1); } } |