x = 4.2 - 0.1
vb.net gives 4.1000000000000005 python gives 4.1000000000000005
4.1000000000000005
Excel gives 4.1<
4.1
There is no problem, really. It is just the way floats work (their internal binary representation). Anyway:
>>> from decimal import Decimal >>> Decimal('4.2')-Decimal('0.1') Decimal('4.1')