It's not a bug but a rounding issue, try to calculate like this: int(sqrt(2))-2 the result will be zero. Any calculation you make in windows calculator, in which the result of the root is the same number you are subtracting will have this error due to rounding.