PDF Editing Issues

How to Round Down PDF Form Calculations to Two Decimal Places

Camila MilosovichCamila Milosovich Nov 3, 2026 870 views

Question details

The user needs to format a PDF form calculation so that it truncates to exactly two decimal places instead of automatically rounding up.

How to Round Down PDF Form Calculations to Two Decimal Places
Product
PDF Editor
Device & OS
not provided
Scenario
Calculating exact mileage costs or financial figures in a fillable PDF form where precise downward rounding (truncation) is procedurally required.
Observed behavior
By default, PDF form fields formatted to two decimal places will round up values like 5.855 to 5.86. The goal state is to force the field to display 5.85.
Before you start

Ensure you have access to a PDF editor that supports custom JavaScript for form fields, and back up your original PDF form before modifying its calculation scripts.

Solution 1Recommended

Use Custom JavaScript to Truncate the Calculation

Apply a custom calculation script using the Math.floor() method to force the final value to round down to exactly two decimal places.

Standard number formatting in PDF forms applies mathematical rounding, meaning values ending in 5 or higher round up. To prevent this, you can bypass the standard formatting and calculate the exact truncated value using a JavaScript snippet.

1
Open Field Properties

Right-click the calculation result field in your PDF editor and select 'Properties' from the context menu.

2
Navigate to the Calculate Tab

Click on the 'Calculate' tab at the top of the Properties dialog box, then select the 'Custom calculation script' radio button.

3
Insert the Truncation Script

Click the 'Edit' button and input your calculation logic, wrapping the final value variable with: event.value = Math.floor(value * 100) / 100; then click OK.

Use Custom JavaScript to Truncate the Calculation
Note on Negative Numbers: The Math.floor() function rounds down to the nearest lower number. For positive values, it works perfectly (5.855 becomes 5.85). However, for negative values, it will round further down (-5.855 becomes -5.86). If working with negative mileage or refunds, use Math.trunc() if supported by your PDF reader.
Advanced PDF Tools

Edit and Calculate PDF Forms Easily with WPS Office

WPS Office provides comprehensive PDF editing tools, allowing you to create fillable forms, manage field properties, and execute custom JavaScript calculations efficiently.

  1. 1. Open the PDF File: Launch WPS Office and open your interactive PDF form document.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive field management tools.
  3. 3. Edit Field Properties: Double-click or right-click any text field to access its 'Properties', where you can easily apply custom calculation scripts or adjust number formatting.
Easily create, edit, and fill interactive PDF forms.Fully compatible with standard PDF forms and Adobe Acrobat JavaScript calculations.Lightweight software with an intuitive, user-friendly interface.Seamlessly extract and export PDF form data to Excel spreadsheets for further analysis.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF form automatically round numbers up?

By default, PDF readers apply standard arithmetic rounding when a field is formatted to display a specific number of decimal places. To change this behavior to strictly round down (truncate), you must bypass the standard format and use a custom JavaScript calculation.

Can I apply custom JavaScript calculations to multiple PDF fields at once?

Calculation scripts are typically applied on a per-field basis in the field's Properties menu. However, if you have many fields, you can define a document-level JavaScript function and simply call that function within the properties of the individual fields to save time.

Is custom PDF JavaScript compatible across different PDF readers?

Basic calculation scripts using core JavaScript math functions like Math.floor() are highly compatible and will work properly across most major PDF software, including WPS Office, Adobe Acrobat, and modern web browser PDF viewers.