Skip to content

IEEE 754 double-precision binary floating-point with N number of significant precision bits

License

Notifications You must be signed in to change notification settings

dividab/double-n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

double-n

npm version code style: prettier MIT license

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

About

IEEE 754 double-precision binary floating-point with N number of significant precision bits

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published