fast-math
Faster equivalent of Math library.
Installation
$ npm install fast-math
Quick start
var FastMath = require; FastMath.abs;
Covering for Math library
Currently the library implements below methods:
- abs(x),
- ceil(x),
- floor(x),
- round(x) - FastMath fixing negative number bad cases like FastMath.round(-1.5) = -2, in Node Math.round(-1.5) = -1 :(
- sign(x)
Performance
Run performance test to see how that library is fast.
npm run performance Start testingEach method will be invoke 999999999 times Test Node Math time: 4572msFastMath time: 1080ms Test Node Math time: 7224msFastMath time: 1341ms Test Node Math time: 7023msFastMath time: 1340ms Test Node Math time: 8552msFastMath time: 1070ms Test Node Math time: 4802msFastMath time: 1080ms Stop testing
Licence
MIT