@rgsoft/math
Advanced tools
Comparing version
@@ -407,14 +407,8 @@ "use strict"; | ||
if (!Number.isInteger(n)) { | ||
throw new Error(`Non integer received: ${n}`); | ||
throw new Error("The number must be an integer"); | ||
} | ||
if (!Number.isInteger(m)) { | ||
throw new Error(`Non integer received: ${m}`); | ||
if (!Number.isInteger(m) || m <= 0) { | ||
throw new Error("Modulo must be a positive integer"); | ||
} | ||
if (m <= 0) { | ||
throw new Error(`Modulo must be positive: ${m}`); | ||
} | ||
while (n < 0) { | ||
n += m; | ||
} | ||
return n % m; | ||
return (n % m + m) % m; | ||
} | ||
@@ -421,0 +415,0 @@ // Annotate the CommonJS export names for ESM import in node: |
{ | ||
"name": "@rgsoft/math", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Yet another JS math library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
66778
-0.91%968
-1.22%