Discussion
1
Replies
2082
Views
Jeeva Shanmugavel
Posted: April 15, 2016
Last activity: April 17, 2016
Closed
Round off issue with Double Values having more than 15 digits
I have a User Input field mapped to a property of type Double.
When the user enters a double with 15 integers and more than 2 decimals, anything after the 2 decimals tends to be omitted.
Similarly, if the value is 14 integers and more than 3 decimals, anything after the 3 decimals is getting omitted.
And PRPC starts rounding off numbers with more than 15 digits.
Is there a way to control the rounding off strategy?
Either use the Decimal type or store the value as a String.
Loss of accuracy when converting to/from double/String is a common occurrence and source of bugs in Java.
Maintaining data accuracy is significantly more important than programming/programmer convenience.
Are you actually using the value to do Math?
If so, in how many situations?