coin-math

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i coin-math

Weekly Downloads

2

Version

0.0.1

License

none

Last publish

Collaborators

  • ypocat