math.sumprecise

1.0.1 • Public • Published

Math.sumPrecise Version Badge

github actions coverage License Downloads

npm badge

An ES-spec-compliant Math.sumPrecise shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.

Getting started

npm install --save math.sumprecise

Usage/Examples

const sumPrecise = require('math.sumprecise');
const assert = require('assert');

// assert.equal(sumPrecise(42.84), 42.84375);
// assert.equal(sumPrecise(0.123), 0.12298583984375);
// assert.equal(sumPrecise(-0.123), -0.12298583984375);
// assert.equal(sumPrecise(1.337), 1.3369140625);
// assert.equal(sumPrecise(65504), 65504);
// assert.equal(sumPrecise(65505), 65504);

Tests

Simply clone the repo, npm install, and run npm test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    262
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    262
  • 1.0.0
    77

Package Sidebar

Install

npm i math.sumprecise

Weekly Downloads

339

Version

1.0.1

License

MIT

Unpacked Size

17.4 kB

Total Files

13

Last publish

Collaborators

  • ljharb