calculate-asmd
Advanced tools
Comparing version 2.3.3 to 2.4.4
{ | ||
"name": "calculate-asmd", | ||
"version": "2.3.3", | ||
"version": "2.4.4", | ||
"description": "The precise addition, subtraction, multiplication and division of JavaScript avoids the error of floating point calculation", | ||
@@ -18,2 +18,3 @@ "license": "MIT", | ||
"jsnext:main": "dist/index.esm.js", | ||
"unpkg": "dist/index.umd.js", | ||
"typings": "typings/index.d.ts", | ||
@@ -20,0 +21,0 @@ "sideEffects": false, |
@@ -16,33 +16,48 @@ # calculate-asmd | ||
<h3>yarn</h3> | ||
`yarn add calculate-asmd` | ||
or | ||
<h3>npm</h3> | ||
`npm install calculate-asmd --save` | ||
<h3>umd</h3> | ||
```javascript | ||
<script src="https://unpkg.com/calculate-asmd@2.4.4/dist/index.umd.js"></script> | ||
OR | ||
<script src="https://unpkg.com/calculate-asmd@2.4.4/dist/index.umd.min.js"></script> | ||
``` | ||
> Tips: You can find the library on window.CalculateAsmd. | ||
<h2>Usage</h2> | ||
``` | ||
import { add, sub, mul, div } from 'calculate-asmd' | ||
const addNum = add(0.2, 0.4); | ||
console.log("add(0.2, 0.4): ", addNum); //add(0.2, 0.4): 0.6 | ||
const addNegative = add(0.2, -0.4); | ||
console.log("add(0.2, -0.4): ", addNegative); //add(0.2, -0.4): -0.2 | ||
import { add, sub, mul, div } from 'calculate-asmd' | ||
const subNum = sub(0.2, 0.4); | ||
console.log("sub(0.2, 0.4): ", subNum); //sub(0.2, 0.4): -0.2 | ||
const subNegative = sub(0.2, -0.4); | ||
console.log("sub(0.2, -0.4): ", subNegative); //sub(0.2, -0.4): 0.6 | ||
const addNum = add(0.2, 0.4); | ||
console.log("add(0.2, 0.4): ", addNum); //add(0.2, 0.4): 0.6 | ||
const addNegative = add(0.2, -0.4); | ||
console.log("add(0.2, -0.4): ", addNegative); //add(0.2, -0.4): -0.2 | ||
const mulNum = mul(0.57, 100); | ||
console.log("mul(0.57, 100): ", mulNum); //mul(0.57, 100): 57 | ||
const mulNegativ = mul(-0.57, 100); | ||
console.log("mul(-0.57, 100): ", mulNegativ); //mul(-0.57, 100): -57 | ||
const subNum = sub(0.2, 0.4); | ||
console.log("sub(0.2, 0.4): ", subNum); //sub(0.2, 0.4): -0.2 | ||
const subNegative = sub(0.2, -0.4); | ||
console.log("sub(0.2, -0.4): ", subNegative); //sub(0.2, -0.4): 0.6 | ||
const divNum = div(0.57, 100); | ||
console.log("div(0.57, 100): ", divNum); //div(0.57, 100): 0.0057 | ||
const divNegative = div(-0.57, 100); | ||
console.log("div(-0.57, 100): ", divNegative); //div(-0.57, 100): -0.0057 | ||
const mulNum = mul(0.57, 100); | ||
console.log("mul(0.57, 100): ", mulNum); //mul(0.57, 100): 57 | ||
const mulNegativ = mul(-0.57, 100); | ||
console.log("mul(-0.57, 100): ", mulNegativ); //mul(-0.57, 100): -57 | ||
const divNum = div(0.57, 100); | ||
console.log("div(0.57, 100): ", divNum); //div(0.57, 100): 0.0057 | ||
const divNegative = div(-0.57, 100); | ||
console.log("div(-0.57, 100): ", divNegative); //div(-0.57, 100): -0.0057 | ||
``` | ||
@@ -65,8 +80,9 @@ | ||
``` | ||
import { scaleNum } from 'calculate-asmd' | ||
scaleNum(0.57, 2) // 57 | ||
scaleNum(0.57, -2) // 0.0057 | ||
scaleNum(0.57, 0) // 0.57 | ||
import { scaleNum } from 'calculate-asmd' | ||
scaleNum(0.57, 2) // 57 | ||
scaleNum(0.57, -2) // 0.0057 | ||
scaleNum(0.57, 0) // 0.57 | ||
``` | ||
@@ -87,1 +103,5 @@ | ||
[license-url]: https://img.shields.io/npm/l/calculate-asmd.svg | ||
``` | ||
``` |
@@ -1,2 +0,2 @@ | ||
export const scaleNum: (Num: number | string, position: number | string) => number | ||
export const scaleNum: (number: number | string, position: number | string) => number | ||
export const add: (arg1: number | string, arg2: number | string) => number | ||
@@ -3,0 +3,0 @@ export const sub: (arg1: number | string, arg2: number | string) => number |
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
26112
8
604
105