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:28 +0000 (16:26 -0400)
commit975057a5ec197a32e3c998d3badb2528fed789b1
tree7e22fdfeb11e653d0cb33a7b789b234220e6e84a
parentcc55a441abeba2a38e0dd61b45c72be48583e286
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