Support Article
Double property fields rounded incorrectly
SA-82855
Summary
Text input field for property of type Double is configured with read-only formatting of type Number with two decimal places. On entering a long value (for example, 123456789123456789.123456789), the focus leaves the field and the value displayed is rounded incorrectly (for example, 123,456,789,123,456,784.00).
For example,
Enter 123456789123456789.123456789 (a long value).

The value displayed is rounded incorrectly as, 123,456,789,123,456,784.00.

Error Messages
Not Applicable
Steps to Reproduce
- Configure a text input field for a Double property with read-only formatting of type Number with two decimal places.
- Enter a long value (for example, a value of 20 digits).
- Tab out of the field such that read-only formatting is displayed.
Root Cause
An issue in the custom application code or rules.
Double data type in Java has a known limitation of 15 to 16 decimal points precision. Since this is the underlying data type for Double properties, it cannot manage large numbers.
Resolution
Perform the following local-change:
Change the properties to Decimal data types. They use Java BigDecimals internally which are designed to handle arbitrary size numbers and are recommended for use in applications where large numbers are encountered.
Published August 19, 2019 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.