smath 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -231,7 +231,9 @@ function factors(n) {
|
|
|
231
231
|
* ```
|
|
232
232
|
*/
|
|
233
233
|
function round2(n, base) {
|
|
234
|
-
|
|
234
|
+
var rounded = base ? base * Math.round(n / base) : n;
|
|
235
|
+
var precision = 10; // Removes precision errors
|
|
236
|
+
return parseFloat(rounded.toFixed(precision));
|
|
235
237
|
}
|
|
236
238
|
/**
|
|
237
239
|
* Calculate the relative normalized error or deviation from any
|