[Koha-bugs] [Bug 36049] New: Rounding prices sometimes leads to incorrect results
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Feb 8 14:44:41 CET 2024
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36049
Bug ID: 36049
Summary: Rounding prices sometimes leads to incorrect results
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P3
Component: Acquisitions
Assignee: raphael.straub at kit.edu
Reporter: raphael.straub at kit.edu
QA Contact: testopia at bugs.koha-community.org
CC: clemens.tubach at kit.edu, katrin.fischer at bsz-bw.de,
michaela.sieber at kit.edu
Example:
Create an order line in acquisitions with vendor price 18.90 and a discount of
5 % results in a total (tax excl.) of 17.95. The correct value in the database
(ecost_tax_excluded) is 17.955000 which should be rounded to 17.96.
The problem is that all financial calculations in Perl and JavaScript are done
with binary floating-point arithmetic instead of decimal arithmetic. For a
short introduction to this topic see https://floating-point-gui.de.
The solution is to use Math::BigFloat in Perl and bignumber.js
(https://github.com/MikeMcl/bignumber.js) or big.js
(https://github.com/MikeMcl/big.js) in JavaScript for every financial
calculation.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list