LP#1282751 Credit card payment balance owed rounding fix
authorBill Erickson <berickxx@gmail.com>
Thu, 15 Sep 2016 19:13:47 +0000 (15:13 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 25 Oct 2016 20:26:06 +0000 (16:26 -0400)
commit4efe500ae5129aa6870bca722146bc94d9f9bfd1
tree8cb43b8d3bc795cff7ecdb615845557f8ad008e5
parent1b921160bdb50b8fe2e44f183e030ffb466d58a2
LP#1282751 Credit card payment balance owed rounding fix

Avoid using Perl's int() when summing owed/paid totals for display in
the TPAC credit card payment form, since this can lead to rounding
errors.

A simple example of why we should not use int() when summing floating
point numbers:

perl -e 'print "no match\n" unless ((8.29 * 100) == int(8.29 * 100))';

Furthermore, use the relatively new fpsum() utility function for summing
floating point numbers so we can avoid having multiple versions of the
summing logic floating (*cough*) around (*cough cough*).

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm