Ensure round methods don't return NaN for large precision values.

This commit is contained in:
John-David Dalton
2016-05-20 08:08:39 -07:00
parent 14a16c2a7a
commit 68ae6fc212
2 changed files with 15 additions and 1 deletions

View File

@@ -4912,7 +4912,7 @@
var func = Math[methodName];
return function(number, precision) {
number = toNumber(number);
precision = toInteger(precision);
precision = nativeMin(toInteger(precision), 292);
if (precision) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.