Jump to content

Rounding errors


adrzei

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?

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...