I was playing with datatypes in python.
Every time, when I do
remaining_amount = .1 + .1 + .1 - .3
python gives an exponential result.
I try to do the same with c#
double remainingAmount = .1 + .1 + .1 - .3
It is also giving result in exponential form.
In both cases, the result is 5.55111512312578E-17
But in c#, when I change double to decimal, the result is 0.0
I am unable to understand why this is happening in both languages. And how can I fix this in python?