Skip to content

Commit 2e657c9

Browse files
committed
#515 Solved
1 parent 601f0bc commit 2e657c9

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

numeral.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,8 @@
395395
power = Math.pow(10, boundedPrecision);
396396

397397
// Multiply up by precision, round accurately, then divide and use native toFixed():
398-
output = (roundingFunction(value + 'e+' + boundedPrecision) / power).toFixed(boundedPrecision);
399-
if (Number(output) > value){
400-
if (output.includes('.')) {
401-
l = output.split('.')[1].length;
402-
new_num = 10 **(-l);
403-
new2_num = Number(output) - new_num;
404-
output = new2_num.toString();
405-
}
406-
output = (roundingFunction(output + 'e+' + boundedPrecision) / power).toFixed(boundedPrecision);
407-
408-
}
398+
output = (roundingFunction((value + 'e+' + boundedPrecision) - 0.5)/ power).toFixed(boundedPrecision);
399+
409400
if (optionals > maxDecimals - boundedPrecision) {
410401
optionalsRegExp = new RegExp('\\.?0{1,' + (optionals - (maxDecimals - boundedPrecision)) + '}$');
411402
output = output.replace(optionalsRegExp, '');

0 commit comments

Comments
 (0)