Skip to content

Commit

Permalink
fix: possible floating point error
Browse files Browse the repository at this point in the history
  • Loading branch information
chaotixkilla authored and joshmh committed Jul 22, 2021
1 parent d590f62 commit 5fa6906
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function mergeTx (oldTx, updateTx) {
bills,
fiat: updateTx.fiat ? oldTx.fiat.add(updateTx.fiat) : oldTx.fiat,
cryptoAtoms: truncateCrypto(
_.reduce((acc, v) => acc.add(toCrypto(mergedTx, BN(v.fiat - v.cashInFee))), BN(0), bills),
_.reduce((acc, v) => acc.add(toCrypto(mergedTx, BN(v.fiat).minus(v.cashInFee))), BN(0), bills),
cryptoCode),
cashInFeeCrypto: truncateCrypto(toCrypto(mergedTx, cashInFee), cryptoCode)
})
Expand Down

0 comments on commit 5fa6906

Please sign in to comment.