coin-math
v0.0.1
Published
Simple functions to convert between the Floating-point and the "Satoshi" integer values (monetary amounts).
Downloads
3
Maintainers
Readme
coin-math
Simple functions to convert between the Floating-point and the "Satoshi" integer values (monetary amounts).
Usage
var coinMath = require('coin-math');
var amount = 1.23456789;
var satoshi = coinMath.floatToFixed(amount, true, true);
var amount2 = coinMath.fixedToFloat(satoshi);
console.log('amount(%d) satoshi(%d) amount2(%d)', amount, satoshi, amount2);
(Please examine the code to learn more about the function parameters.)
License
MIT