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

Round up at 2 decimal places

paulaeddy
Registered: May 14 2010
Posts: 22
Answered

I need a script that rounds up at the second decimal place. This is what I have:

var result = this.getField("Text2").value * .00115;
event.value = result;

If Text2 = 1689.00, then event.value = 1.94235. How can I make the result = 1.95 (round up at the second decimal place)?

My Product Information:
Acrobat Standard 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Change the second line to:
event.value = (Math.ceil(result*100))/100;

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

paulaeddy
Registered: May 14 2010
Posts: 22
Wonderful! Thanks so much.