Socket
Socket
Sign inDemoInstall

archi

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    archi

Easy math with decimals for Javascript


Version published
Weekly downloads
76
increased by65.22%
Maintainers
1
Install size
34.7 kB
Created
Weekly downloads
 

Readme

Source

+archi Greenkeeper badge

Easy math with decimals for Javascript

Archimedes

Install

Using npm

npm install archi

Using bower

bower install archi

Native simple Javascript sum

0.1 + 0.2; // 0.30000000000000004;
0.3 - 0.1; // 0.19999999999999998;

Solving the issue with archi

var archi = require('archi');
var num = +archi
  .calc(0.1)
  .plus(0.2)
  .plus(0.1)
  .minus(0.1); // 0.3
num === 0.3; // true

But, why the + ahead?

Do this to do a fast conversion from the ArchiNumber instance to the native Number type.

Methods

  • .plus(num): current num + other num
  • .minus(num): current num - other num
  • .mod(num): current num % other num

License

MIT

Keywords

FAQs

Last updated on 08 Aug 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc