README
double-n
IEEE 754 double-precision binary floating-point with N number of significant precision bits
Installation
npm install --save uom
The library is compiled to ES5 and no polyfills are required.
Usage
import * as DoubleN from "double-n";
const num = 7.000002;
DoubleN.numberToDoubleN(num, 51); // 7.000002
DoubleN.numberToDoubleN(num, 40); // 7.000001999997039
DoubleN.numberToDoubleN(num, 21); // 7.000001907348633
DoubleN.numberToDoubleN(num, 20); // 7
DoubleN.numberToDoubleN(num, 2); // 7
DoubleN.numberToDoubleN(num, 1); // 6
DoubleN.numberToDoubleN(num, 0); // 4