From ed284b9ca93f03b9dc8fce3744baab59588d43f1 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 24 Nov 2015 11:39:40 -0800 Subject: Fix tolerance calculation --- public/js/wallet.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/js/wallet.coffee b/public/js/wallet.coffee index d9ef9b29..b7a71d7e 100644 --- a/public/js/wallet.coffee +++ b/public/js/wallet.coffee @@ -39,7 +39,9 @@ $(-> $('#amount').attr('step', 0.01) else amount = parseFloat($('#amount').val() * multiplier() / g.exchange).toFixed(precision()) - if Math.abs(g.amount - amount).toFixed(precision()) > (.000000005 * g.exchange * multiplier()).toFixed(precision()) + difference = parseFloat(Math.abs(g.amount - amount).toFixed(precision())) + tolerance = parseFloat((.000000005 * g.exchange * multiplier()).toFixed(precision())) + if difference > tolerance $('#amount').val(amount) else $('#amount').val(g.amount) -- cgit v1.2.3