[Koha-bugs] [Bug 36049] Rounding prices sometimes leads to incorrect results

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Feb 9 10:03:46 CET 2024


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36049

--- Comment #6 from Raphael Straub <raphael.straub at kit.edu> ---
(In reply to David Nind from comment #3)
> Also wondering whether this is the same/similar to bug 35114
The similarity to bug 35114 is that both bugs deal with rounding issues. Thats
why I added this bug to "See Also".

I think that the patch in bug 35114 only solves part of the problem by
rearranging rounding operations and using a nearest rounding mode instead of
truncation in JavaScript. Yes, it improves the situation as there are fewer
cases with incorrect results, but cases with incorrect results still remain as
the underlying problem is not using decimal arithmetic. For example
"Math.round(18.90 * (100 - 5)) / 100" in JavaScript evaluates to "17.95"
instead of "17.96". This can only be fixed by using a decimal arithmetic
package like bignumber.js or big.js.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list