New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

math-exact

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-exact

Precision math for JavaScript/TypeScript

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
366
increased by139.22%
Maintainers
1
Weekly downloads
 
Created
Source

Math Exact (Floating Point Math)

npm version npm downloads

Features

  • ✅ Built with TypeScript
  • ✅ Tested with Jest

Built With

Pending Items

  • [ ]

Getting Started

1. Install Package:

npm i math-exact

Example Code

Add:

// Imports: Dependencies
import { mathExact } from 'math-exact';

mathExact('Add', 1, 2); // 3
mathExact('Add', .1, .2);  // .3
mathExact('Add', 1.123, .2);  // 1.323
mathExact('Add', .02, 1.123); // 1.143

Subtract:

// Imports: Dependencies
import { mathExact } from 'math-exact';

mathExact('Subtract', 1, 2): // -1
mathExact('Subtract', .1, .2);  // -.1
mathExact('Subtract', 1.123, .2);  // .923
mathExact('Subtract', .02, 1.123); // -1.103

Multiply:

// Imports: Dependencies
import { mathExact } from 'math-exact';

mathExact('Multiply', 1, 2); // 2
mathExact('Multiply', .1, .2);  // .02
mathExact('Multiply', 1.123, .2);  // .2246
mathExact('Multiply', .02, 1.123); // .002246

Divide:

// Imports: Dependencies
import { mathExact } from 'math-exact';

mathExact('Divide', 1, 2); // .5
mathExact('Divide', .1, .2);  // .5
mathExact('Divide', 1.123, .2);  // 5.615
mathExact('Divide', .02, 1.123); // .017809439002671415

Changelog

[1.0.5] - 12/11/2020

Changed

  • Fixed build file issue.

[1.0.4] - 12/11/2020

Changed

  • Changed decimal points from 17 to 15.

[1.0.3] - 12/11/2020

Changed

  • Fixed build file issue.
  • Updated README example code.

[1.0.2] - 12/10/2020

Changed

  • Updated README title & example code.

[1.0.1] - 12/10/2020

Changed

  • Updated README example code.

Keywords

FAQs

Package last updated on 11 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc