Bug 3166 - Fines are summing off by 1 penny due to rounding issue when summing.
Summary: Fines are summing off by 1 penny due to rounding issue when summing.
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: rel_3_0
Hardware: All All
: P5 - low minor (vote)
Assignee: Galen Charlton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-27 08:41 UTC by Chris Cormack
Modified: 2016-02-04 10:54 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:07:14 UTC


---- Reported by drdrulm@yahoo.com 2009-04-27 20:41:16 ----

Fines are summing off by 1 penny due to rounding issue when summing. 

This only occurs when summing many many records. The round off error occurs in the summation. 

There is a multiplicand of 100 and then a divisor of 100. To ensure the summation will work for many fines, just make the multiplicand 1000 and the divisor 1000.

If there is still a problem with this, then bump it to 10000.

-D.Ulm



---- Additional Comments From gmcharlt@gmail.com 2009-04-27 20:43:45 ----

Darrell, do you have an example in your database that I can look at?



---- Additional Comments From rch@liblime.com 2009-04-30 22:26:33 ----


I think the proper way to do this is to do integer math.  Do we really need to support more than two decimal places ?  If so,
I suggest a system preference for CurrencyDecimalPlaces and a fcn C4::Output::as_currency().  (Or C4::Koha::).
The db will then always hold an integer value of 'cents' (or amount * 10^(CurrencyDecimalPlaces) ).



---- Additional Comments From drdrulm@yahoo.com 2009-07-22 14:04:28 ----

Patch sent again! :) Simple one. Please accept. Occurs with patrons with long list of fines. 



---- Additional Comments From gmcharlt@gmail.com 2009-07-22 14:27:45 ----

Pushed patch.  Bug should remain open, as we should switch to purely integer math as Ryan suggests.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:07 UTC  ---

This bug was previously known as _bug_ 3166 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3166

Actual time not defined. Setting to 0.0
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here: chris@bigballofwax.co.nz.
   Previous reporter was drdrulm@yahoo.com.
CC member adrea@moablibrary.org does not have an account here
CC member drdrulm@yahoo.com does not have an account here
CC member melanie@salpublib.org does not have an account here
CC member rch@liblime.com does not have an account here

Comment 1 Paul Poulain 2011-02-22 21:46:28 UTC
1- can't find the patch
2- can't find/imagine which script is concerned

=> hard to decide wether we should close this bug or not. Any idea someone ?