1.0.12 • Published 1 year ago

math-float-deal v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Dealing with the issue of precision loss in JavaScript decimal calculations

1.install

npm i -s math-float-deal

2.import

import { plus, minus, multiply, divide } from "math-float-deal"

3.use

-

console.log(0.13333 + 0.22); // 0.35333000000000003
console.log(plus(0.13333, 0.22)); // 0.35333

-

console.log(0.333 - 0.22); // 0.11300000000000002
console.log(minus(0.333, 0.22)); // 0.113

-

console.log(0.3 * 0.17); // 0.051000000000000004
console.log(multiply(0.3, 0.17)); // 0.051

/

console.log(0.333 / 0.12); // 2.7750000000000004
console.log(divide(0.333, 0.12)); // 2.775
1.0.12

1 year ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago