Double calculation result not correct

Hi, I tried to minus two double, but the result is not correct.
doubleA (11.38) - doubleB (11)
it returns 0.380000000000001.

May I have any comments. Thanks.

1 Like


I think that is same across many languages. Others can correct me if I am wrong because python also give same o/p.

yes, the output precision is an approximate binary representation in case of some decimal values.
This is sometimes greater or less than the actual answer :slight_smile:

Please format your result 2 decimal places and you should be good