VirtueMart Forum
VirtueMart 2 + 3 => Virtuemart Development and bug reports => Development & Testing => Topic started by: John2400 on May 09, 2012, 15:33:39 pm

I have again set a postage of 8.50 cents . when I choose postage in the back end it shows $9.00 and then when in the large cart it is 8.50 cents but the small cart shows a rounding to $9.00 .
Image attached.
Also the small shopping cart shows the incorrect rounding 
Version 2.0.7 c is the image called "mail"
[attachment cleanup by admin]

New version 2.0.7c tested results the same
thanks

New version tested (d)  same rounding same as original issue.

Ok rounding ,
after a few posts back and forth  I will have to say that rounding in different currencies may be different. 04 should round down , 59 should round up. but only in the units column and not the tens.
Decimals and decimal currency actually round differently.
1.5 in a decimals can rounds up to 2 but $1.50 cents cannot round in currency to $2.00 that is too far only $1.98. 99 can round to $2.00 in australia. We no longer use 1cent , 2 cent coins.
I refer to the site : http://en.wikipedia.org/wiki/Rounding
and say that my website will try and stay with whole numbers is a better solution.
Not a major issue for me.

I still do not understand how you think it should be shown then.
when you want to have only whole numbers, how to display 8.5 then? as 8.5? is not a whole number? so there exists only 8 or 9.

* the real answer to this in the cart is that  "Australian currency , banks, paypal will eventually round this correctly with no help from VM." However the invoices may vary slightly due to various charges. So you could have no rounding configurations set.
I'll try again
Money rounding is different than decimal rounding. ( even though the maths looks OK and it is rational to think that taking 50 cents up)
* I copied this from a web site : regarding Australian money
Normal Rules for rounding ( normal like you expect )
If the digit after the one being rounded is less than 5 (0, 1, 2, 3 or 4), we round down.
If the digit after the one being rounded is 5 or more (5, 6, 7, 8, or 9), we round up.
Examples:
•Rounding 76 to the nearest ten, gives 80 because 6 is greater than 5 (round up)
•Rounding 932 to the nearest hundred, gives 900 because 3 is less than 5 (round down)
But rules for Rounding money amounts
We no longer have 1 cent and 2 cent coins in Australia, so all money amounts paid in cash/or finalized need to be rounded to the nearest 5 cents (5c).
Rules for rounding money amounts ( Australian Money)
Cash amounts ending in 0c or 5c, do not change.
If the number of cents ends in 1c or 2c, it is rounded down to 0. Example: $2.52 is rounded down to $2.50.
If the number of cents ends in 3c or 4c, it is rounded up to the nearest 5c. Example: $7.63 is rounded up to $7.65.
Cash amounts ending in 6c or 7c are rounded down to the nearest 5c. Example: $6.16 is rounded down to $6.15.
Cash amounts ending in 8c or 9c, round up to the nearest 10c. Example: $10.99 is rounded up to $11.00.
______________________________________________________________________________________________
* I'll try again with the example of selling Australian Fuel. If a customer purchases $8.50 cents worth of fuel at the gass station . When he goes to pay at the counter. The attendant cannot round that number in Currency to $9.00 . (that is the law).
* If he buys fuel costing $8.98, $8.99 ( the attendant by law can (and does) round that up to $9.00) (that is the law) ( these are the only numbers in currency you are allowed to round to $9.00)
We do not have in Australia  anymore a 1 or 2 cent coins. We do have 5cent and 10 cent coins (so rounding is a little different in currency than the actual idea or rounding in Maths).
* So really the only time in the shopping cart that the rounding should take place is the final total  not at any time before. Sorry I know this might seem odd but it is correct.
* Just for a funny example  everyone in Australia, at some time has stood at the gas station and tried to purchase $8.02 cents of fuel because it will round down to $8.00. Buy if you buy $8.50 cents of fuel you Pay $8.50 cents of fuel only. And there would be a fight if you rounded it up to $9.00.
Again we will try and get around this by making whole numbers on products. OR postage etc
* When every thing goes through Paypal here  they normally add 30 cents and rounding starts again. ( small purchase)