aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library.js6
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);
}
}