@aryth/math
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -7,2 +7,4 @@ 'use strict'; | ||
/** | ||
* | ||
* applicable for smaller number | ||
* @param {number} x | ||
@@ -13,2 +15,9 @@ * @returns {number} | ||
const round = x => x + (x > 0 ? 0.5 : -0.5) << 0; | ||
const E2 = 1E+2; | ||
const E4 = 1E+4; | ||
const MILLION = 1E+6; | ||
const roundD1 = x => Math.round(x * 10) / 10; | ||
const roundD2 = x => Math.round(x * E2) / E2; | ||
const roundD4 = x => Math.round(x * E4) / E4; // export const roundD2=x=>Math.round() | ||
/** | ||
@@ -34,2 +43,5 @@ * Get an integer absolute of a number | ||
exports.E2 = E2; | ||
exports.E4 = E4; | ||
exports.MILLION = MILLION; | ||
exports.abs = abs; | ||
@@ -41,1 +53,4 @@ exports.almostEquals = almostEquals; | ||
exports.round = round; | ||
exports.roundD1 = roundD1; | ||
exports.roundD2 = roundD2; | ||
exports.roundD4 = roundD4; |
const abs = n => n < 0 ? 0 - n : n; | ||
/** | ||
* | ||
* applicable for smaller number | ||
* @param {number} x | ||
@@ -8,2 +10,9 @@ * @returns {number} | ||
const round = x => x + (x > 0 ? 0.5 : -0.5) << 0; | ||
const E2 = 1E+2; | ||
const E4 = 1E+4; | ||
const MILLION = 1E+6; | ||
const roundD1 = x => Math.round(x * 10) / 10; | ||
const roundD2 = x => Math.round(x * E2) / E2; | ||
const roundD4 = x => Math.round(x * E4) / E4; // export const roundD2=x=>Math.round() | ||
/** | ||
@@ -29,2 +38,2 @@ * Get an integer absolute of a number | ||
export { abs, almostEquals, almostInt, intAbs, intExpon, round }; | ||
export { E2, E4, MILLION, abs, almostEquals, almostInt, intAbs, intExpon, round, roundD1, roundD2, roundD4 }; |
{ | ||
"name": "@aryth/math", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A math util library", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.cjs.js", | ||
"homepage": "https://github.com/hoyeungw/aryth#readme", | ||
"gitHead": "37243125d4bae3bc432636026516c30f8c2e64e3" | ||
"gitHead": "c0890f1284b22209726d942f6fb2aac8cea11ca5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5318
77