fix truncateSatoshis for x === 0

This commit is contained in:
Josh Harvey 2014-12-04 18:13:14 -05:00
parent e230edc3f7
commit a7fb79016f

View file

@ -177,6 +177,7 @@ function billsAndTxs(client, session, cb) {
// lamassu-machine and lamassu-server and need to stay in sync. // lamassu-machine and lamassu-server and need to stay in sync.
function bitcoinFractionalDigits(amount) { function bitcoinFractionalDigits(amount) {
var log = Math.floor(Math.log(amount) / Math.log(10)); var log = Math.floor(Math.log(amount) / Math.log(10));
if (log < -8) log = -8;
return (log > 0) ? 2 : 2 - log; return (log > 0) ? 2 : 2 - log;
} }