[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does bug 2921 justify a version 3.19.4?



Am 04.08.24 um 13:56 schrieb Gianluigi:

I'm referring to what is in question and Christof's comment on the bugtracker (Wow cool, thank you! The discussion even made me doubt
my own thinking. Good, that it's fixed!) At this point I'm the one
who's perplexed, I've always believed that to manage the currency in
Gambas it would be necessary to save the amounts as integers, right?
1.: The bug has something to do with the currency, but not alone. The
fact that I used the name 'price' for the variable is misleading.

2. (store currency as integer): Not necessarily. I read that SAP for
example stores currency as 'Numeric' with four decimal places. For
example, if you calculate internally in your software with net amounts
and then add the value added tax (VAT) to calculate the gross amount
(which is the price for the customer), saving the net amount in the form
of integer cents often leads to rounding errors. So the decision to
store the net amount with four decimal places makes sense.

> How should numbers representing amounts be saved?

At best in the database as 'Numeric' which is exact. It can be seen as
'integer-dot-integer'.

https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-numeric/

Alles Gute

Christof Thalhofer

--
Dies ist keine Signatur


References:
Does bug 2921 justify a version 3.19.4?Christof Thalhofer <chrisml@xxxxxxxxxxx>
Re: Does bug 2921 justify a version 3.19.4?Gianluigi <gradobag@xxxxxxxxxxx>