PRPC function calculation incorrect
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.
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.
Suggested to use String constructor for BigDecimal is more accurate than the decimal constructor when multiplying.
Published January 31, 2016 - Updated October 8, 2020
Was this useful?
0% found this useful
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.