My understanding is the maximum digits to safely represent a number as double in Java is 2^53-1, or 9007199254740991. And that is regardless of decimals because that's represented by exponent bits. Consider the following:
double dblprice = 9007.199254740991;
System.out.println(dblprice);
dblprice = 9007199.254740991;
System.out.println(dblprice);
The output is
9007.199254740992
9007199.25474099
Which I don't understand why for first case the last 1 is replaced by 2 and for the 2nd case, the last digit is dropped. Thanks a lot!