decimal-subtract
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

Decimal Subtract v1.5.0 Documentation

NPM Version Package License

Table of contents

Description

Workaround for JavaScript's decimal numbers subtraction problem.

Installation

For the usage in CJS or ESM run the following command:

npm i decimal-subtract

For script tag usage include the following script:

<!DOCTYPE html>
<html>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/decimal-subtract@1.5.0/dist/decimal-subtract.min.js"></script>
  </body>
</html>

Usage example

ESM:

import { decimalSubtract } from 'decimal-subtract'

console.log(1 - 0.55) // 0.44999999999999996
console.log(decimalSubtract(1, 0.55)) // 0.45

Classic:

console.log(1 - 0.55) // 0.44999999999999996
console.log(window.decimalSubtract.decimalSubtract(1, 0.55)) // 0.45

Package Sidebar

Install

npm i decimal-subtract

Weekly Downloads

0

Version

1.5.0

License

ISC

Unpacked Size

5.09 kB

Total Files

8

Last publish

Collaborators

  • datomarjanidze