mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
fix: limit the precision when the precision is negative (#4085)
This commit is contained in:
committed by
John-David Dalton
parent
c3740e0847
commit
377e2d87c8
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user