Help with javascript rounding
Hi !
I have a problem with a form that includes an addition of 3 fields, but that gives me a "wrong" answer because unlike the "displayed value" in each field (that is rounded to 2 decimals), the Total field does not take into account the rounded sums, and hence my total is "wong" by 1 cent.
I know this is a typical problem, and yes, I have searched on MANY forums on javascript and adobe... and I have tried to paste or arrange some line of javascript, but since I don't know anything about it, I get "syntactical errors"...
So, more specifically, here are the 3 fields that needs to add up:
Regular priceSUBTOTAL
Regular priceTAX1
Regular priceTAX2
and the total field is:
TOTAL REGULAR
To give you the concrete example I have trouble with, here are the numbers:
Regular priceSUBTOTAL = 99,50$
Regular priceTAX1 = 4,98$ (rounded up from 4,975)
Regular priceTAX2 = 9,93$ (rounded up from 9.925125)
the total should be: 114,41, but it displays 114,40 (an obvious mistake)
as the exact value is 114.400125
So... what should I do in order to get 114,41$ in the Total field ?
What line of javascript do I need to incorporate?
And where? (as a Custom Validation script or a Custom Calculation script?)
Any help will be greatly appreciated.
Thanks in advance!
fod
