[ic] Currency Conversion Floating Point Errors?

Jake DiBella jake at geton.ca
Wed Feb 25 21:39:31 UTC 2009

Hi All,

Recently, I've been getting some strange rounding errors when applying currency conversion to products. I have a product priced at $300.00 USD, and I'm applying a 5% tax to it.  When done using USD, the amount correctly gets calculated as $15.00.  Upon entering a Canadian address, and after changing the State/Province dropdown accordingly, the new price is incorrect.  The prices are as follows:

Price: $300.00
GST (5%):   $15.00

Price: $333.33
GST (5%):   $18.52

http://www.paste.me.uk/1263.html - Shopping Cart code
http://www.paste.me.uk/1264.html - PriceDivide settings
http://www.paste.me.uk/1265.html - State table excerpt

I think the issue is caused by a floating point rounding error occurring in the [currency] tag, but I don't know how to go about fixing this.  Can anyone help?

Jake DiBella
GetOn.com Technologies

More information about the interchange-users mailing list