I am using Math.round()
. This is the sample code:
double value = 0.14499999970197677;
value = Math.round( value* 100.0) / 100.0;
My expectation is it should return 0.15
but it is returning 0.14
Also, if the value is 0.13499999970197677
, then it is returning 0.13
, why not 0.14
I have already gone through the link round up to 2 decimal places in java?
Please tell me clearly that why this is happening with both the numbers?