Fix Acrobat JavaScript Rounding to Two Decimal Places
Question details
Display calculated Acrobat form values to two decimal places and handle rounding consistently in financial calculations.

- Product
- Adobe Acrobat PDF forms
- Device & OS
- not provided
- Scenario
- A calculated PDF form field applies a percentage to a monetary value.
- Observed behavior
- A calculation can produce a value such as 82.215 when the desired display is 82.22.
Open the PDF in Adobe Acrobat and identify the source field and the calculated destination field. Confirm the rounding rule required for your form, especially for values that fall halfway between cents.
Format the Acrobat calculation to two decimal places
Use Acrobat JavaScript formatting when the main goal is to control how the calculated result is displayed.
In Acrobat, open the PDF and choose All tools > Prepare a form. Select the calculated destination field and open its Properties.
On the Calculate tab, select Custom calculation script and click Edit. Enter: event.value = util.printf("%.2f", Number(this.getField("Amount").value) * 0.90); Replace Amount with the actual source field name.
On the Format tab, choose Number and set Decimal Places to 2. Close the field properties, then enter a test value in the source field and check the result.

Calculate a 90% amount using whole cents
Use integer cents when nonnegative currency inputs have no more than two decimal places and each result must be rounded to a cent.
Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and common Office files. It supports a smooth move between document formats, though it does not fix Acrobat-specific JavaScript calculations.

Frequently Asked Questions
Where do I set two decimal places in an Acrobat form field?
Choose All tools > Prepare a form, open the destination field's Properties, and select Number with 2 decimal places on the Format tab.
Does util.printf fix every financial rounding error?
No. util.printf("%.2f", value) formats the result, but floating-point representation can affect halfway cases, and formatting does not fix fractional cents accumulated in earlier calculations.
Why use whole cents in a calculation?
Whole-cent arithmetic makes it easier to apply a consistent rounding rule at each calculation stage. For example, calculate a 90% result from integer cents, round that result to a cent, and divide by 100 for display.
What should I change if my source field is not named Amount?
In the custom calculation script, replace Amount in this.getField("Amount") with the exact name of your source form field.




