How to Round Down PDF Form Calculations to Two Decimal Places
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.

- 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.
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.
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.
Right-click the calculation result field in your PDF editor and select 'Properties' from the context menu.
Click on the 'Calculate' tab at the top of the Properties dialog box, then select the 'Custom calculation script' radio button.
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.

Set Standard Two-Decimal Formatting
If standard rounding (where 5.855 rounds up to 5.86) is acceptable for your use case, simply adjust the field's built-in number format settings without coding.
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. Open the PDF File: Launch WPS Office and open your interactive PDF form document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive field management tools.
- 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.

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.




