Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

PRPC function calculation incorrect

SA-7309

Summary



When Developer is trying to perfrom the multiplication of a large decimal number the result showing up is not correct.

For example, if the price is 20000000000000.123456789, and the quantity is 1.00, the total should be 20000000000000.123456. (Since qunatity is 1, the result should be the same as price.)

However, clipboard, the result is slightly different.
.Price 20000000000000.123456789
.Quantity 1.00
.Total 20000000000000.125000

Creating a simple function (ScaleFormat) in PRPC that will fix the digits to 6 after decimal point, Use this function to format the result of two values multiplication. The function is just rounding floor, and the correct answer should be 20000000000000.123456.



Resolution



Suggested to use String constructor for BigDecimal is more accurate than the decimal constructor when multiplying.
 
Suggest Edit

Published January 31, 2016 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us