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

  1. Configure a text input field for a Double property with read-only formatting of type Number with two decimal places.
  2. Enter a long value (for example, a value of 20 digits).
  3. 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 June 26, 2019 — Updated August 19, 2019

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.