]> git.evergreen-ils.org Git - contrib/Conifer.git/commit
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:29:01 +0000 (16:29 -0400)
commit1421e7dc15ebdf946006bfadc924efb125a0d60b
tree508de2855644e37d36c819dd874166ce802ba438
parent17ddf95b1736f708bbf2bf1c4c50911142fbc151
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