You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the extension is using float type to calculate money. Float operations should be avoided in money calculation as it leads to unavoidable inaccuracy (such as 0.3000001). Could you use the bcmath library for high-precision calculations and change the type to currency or decimal in database?
The text was updated successfully, but these errors were encountered:
For the decimal database type, I thought about it earlier but the problem is that you have to specify the number of decimals you want to keep, and this can vary a lot between 2 extension users.
For the bcmath functions, they need a PHP module to be installed so it may not be portable, however I'll take a look at it.
To solve this problem, I also thought of storing the money as an integer in database, and add a display settings for this extension to divide the money visually in the frontend.
For example, it would be stored in database as 1234567 with a division settings of 100 and it would display as 12345.67 in the forum.
Yes I think it's a good idea to use integer so that it would be more compatible with the large amount of extension which depends on this extension. Website administrator can easily make the old extension works by multiply the original money amount by 100 even the extension has not update.
I wonder if it will be accomplish in furture version?
I noticed that the extension is using float type to calculate money. Float operations should be avoided in money calculation as it leads to unavoidable inaccuracy (such as 0.3000001). Could you use the bcmath library for high-precision calculations and change the type to
currency
ordecimal
in database?The text was updated successfully, but these errors were encountered: