LP#1282751 Credit card payment balance owed rounding fix user/berick/lp1282751-cc-payment-rounding-error
authorBill Erickson <berickxx@gmail.com>
Thu, 15 Sep 2016 19:13:47 +0000 (15:13 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 15 Sep 2016 19:13:49 +0000 (15:13 -0400)
commit50900fa39d2707f8a1dd3d82b379ae89505d5be7
treee96998e4b3cd2e16b2e7f31cadb1877f9e23e474
parent6bd672af7d6c755c36b65f8efa336002a8a36d5a
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>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm