These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Multiplication round-up

sarahd
Registered: Jul 5 2007
Posts: 6

I have a form where I need to multiply a dollar value(Grand total) x a qty. to get an Extended Total. Under my calucation tab I have the product(x) selected and have defined the two fields I want to multiply. My problem is the extended total is not calculating the same as what I get on my calculator. I don't think it is rounding up my Extended Total.

For Example:
Grand Total = $87.26
x Qty 387
Extended Total = $33,768.41 (On my caculator the answer is $33,769.62)

Why am I getting two different answers?

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Are you actually multiplying by "87.26" or some computed value that is actually "87.25687+" but your field display format only shows "$87.26" due to rounding up of the intermediary value.

If you are computing your price, use JavaScirpt "util.printf()" method to round the computed value to 2 decimal places.

George Kaiser

sarahd
Registered: Jul 5 2007
Posts: 6
It is showing that long number 87.25687+ is being calculated. How do I change that? On my format tab I have it as number and 2 decimal places but it is putting extra numbers after the decimal place. Is there a way to prevent that? Thank you for your help!
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
In Acrobat, not LiveCycle Designer, you can use the "util.Printf("%,0 .2", price);" method to round the value to 2 decimal places, or the "Math.round(price * 100) / 100".

For LiveCycle Designer one can use the FormCalc "Round(price, 2)" function.

George Kaiser