Jump to content
adrzei

Rounding errors

Recommended Posts

Hello,

With the last annual financial statement we found some rounding errors in our outgoing invoices (15-20%).

Example (negative invoice): 


5a1e6bc29cb0e_2017-11-2909_11_20-Client1507EditInvoice2015-25752_NetCIX.png.314827634c2b5780aff5b84417ab1327.png

 

Correct calculation: -0,1103 * 1,19 = -0,1313 = -0,13

 

Example (positive invoice):

5a1e6e29ac979_2017-11-2909_21_07-Client1554EditInvoice2016-31889_NetCIX.png.713c40037f34a4397f0372e70dac5a85.png

 

Correct calculation: 16,18 * 1,19 = 19,2542 = 19,25

 

How are these values calculated?

Share this post


Link to post
Share on other sites
On 29/11/2017 at 8:23 AM, adrzei said:

16,18 * 1,19 = 19,2542 = 19,25

i think this happen with the currency format converter, so 19,2542 it will be 19,25 after a currency format . and the currency fomat is not doing any rounding , is only a decimal extract and return .

 

Share this post


Link to post
Share on other sites
4 minutes ago, Blesta Addons said:

i think this happen with the currency format converter, so 19,2542 it will be 19,25 after a currency format . and the currency fomat is not doing any rounding , is only a decimal extract and return .

 

That makes even less sense. If the values are truncated, they should have been correct in my examples. Instead, it was rounded, but wrong.

Share this post


Link to post
Share on other sites
8 minutes ago, adrzei said:

That makes even less sense. If the values are truncated, they should have been correct in my examples. Instead, it was rounded, but wrong.

so my analysis is wrong, in first i have thinked it worked that way, a fter a small look in the code, i found the function return two value; the "amount" with the real somme and "amount_formated" that is converted and formatted to the currency. and it appear is rounded.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×