Product Price Updated with Javascript Half Down in Magento 1.7

ce-1.7.0.2custom-optionsjavascriptpricetax

I have a strange problem. I have a product with the price 81.50, the tax is 19%, so the regular price is 96.985. In PHP I use rounding with half up. The price on product page is 96.99 which is corect, but when the page finishes loading the price is updated to 96.98. What could be the problem?

Is there a function JS which updates the rounded price on page?

Update 1

The problem is present only for products with custom options (ex: color), even if it has just one option and the price for it is 0.00.

Best Answer

I think you could use a hack for this. Edit in js/varien/products.js file the function formatPrice:

formatPrice: function(price) {
    price = (Math.round(price*100)/100);

    return formatCurrency(price, this.priceFormat);
}