PDF Editing Issues

Display Two Decimal Places Without Rounding in an Acrobat Form

Natalie TaylorNatalie Taylor Nov 24, 2026 868 views

Question details

The user needs a PDF form calculation to display two decimal places by truncating rather than rounding the result.

Display Two Decimal Places Without Rounding in an Acrobat Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A calculated form field uses values from other fields and must show the result with exactly two decimal places.
Observed behavior
The desired result keeps two decimal places and discards subsequent digits without rounding.
Before you start

Open the form in an Acrobat version that supports editing form fields, and identify the source and calculated field names. The example below uses source fields named NMS and CMS and calculates (NMS - CMS) / CMS.

Solution 1Recommended

Use a Custom Acrobat Calculation Script to Truncate Decimals

Use this method when a calculated form field must display two decimal places without rounding.

The script truncates toward zero, so a negative result such as -1.239 becomes -1.23. Using toFixed(2) alone would round the value instead.

1
Open the form editor

In Acrobat, open the PDF and select All tools > Prepare a form. Double-click the calculated field to open its Properties.

2
Set the field format

In the field's Format tab, select None so the field's formatting does not apply separate rounding.

3
Enter the calculation script

On the Calculate tab, select Custom calculation script and click Edit. Enter the following script, replacing NMS and CMS with your actual field names if necessary: var v1 = Number(this.getField("NMS").valueAsString); var v2 = Number(this.getField("CMS").valueAsString); function twoDecimals(value) { var scaled = value * 100; var truncated = scaled < 0 ? Math.ceil(scaled) : Math.floor(scaled); return (truncated / 100).toFixed(2); } if (v1 === 0 || v2 === 0) { event.value = ""; } else { event.value = twoDecimals((v1 - v2) / v2); }

4
Save and test the form

Click OK to save the script, close field Properties, and preview the form. Enter test values in NMS and CMS, including values that produce negative results, and check the calculated field.

Use a Custom Acrobat Calculation Script to Truncate Decimals
Check zero values and precision: This example leaves the result blank if either input is zero; CMS must not be zero because it is the divisor. JavaScript floating-point precision can affect boundary values, so test representative inputs if exact decimal arithmetic is essential.
Free Microsoft Office alternative

Work With PDF and Office Files in WPS Office

WPS Office is a free, lightweight alternative for working with documents, spreadsheets, presentations, and PDFs in a familiar interface. Its Office format compatibility makes it easy to bring existing files into your workflow; use Acrobat to edit and test the form calculation script described above.

Open and work with PDF files alongside Office documentsCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for an easier transition from Microsoft OfficeFree, lightweight tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't toFixed(2) truncate the calculation?

JavaScript's toFixed(2) rounds a number to two decimal places. Truncate the value first, then use toFixed(2) to display exactly two digits after the decimal point.

Where do I add the calculation script in Acrobat?

Open All tools > Prepare a form, double-click the result field, and go to Calculate > Custom calculation script > Edit.

Does Math.floor truncate negative numbers toward zero?

No. Math.floor moves negative numbers down to the next integer, away from zero. Use Math.ceil for a negative scaled value and Math.floor for a positive one to truncate toward zero.

Why is the calculated field blank when I enter zero?

The example script sets event.value to an empty string when either input is zero. The CMS value is also the divisor, so it must not be zero.