Skip to content

Commit

Permalink
fix: limit the precision when the precision is negative (lodash#4085)
Browse files Browse the repository at this point in the history
  • Loading branch information
asilinwei authored and jdalton committed Nov 28, 2018
1 parent c3740e0 commit 377e2d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .internal/createRound.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
function createRound(methodName) {
const func = Math[methodName]
return (number, precision) => {
precision = precision == null ? 0 : Math.min(precision, 292)
precision = precision == null ? 0 : (precision >= 0 ? Math.min(precision, 292) : Math.max(precision, -292))
if (precision) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
Expand Down

0 comments on commit 377e2d8

Please sign in to comment.