123.3 + 0.1 is 123.4 if using a variable

Paul Boddie paul at boddie.net
Tue Jun 3 09:54:46 EDT 2003


dwblas at yahoo.com (D.W.) wrote in message news:<895e4ce2.0306021715.4cc0ba06 at posting.google.com>...
> Evidently, python has different rules for numbers entered in
> interactive mode.

It depends on the "evidence".

> x = 123.3
> print x

# Yes, a different number (it works better for this example):
x = 123.4
print x
print repr(x)

> Results:
> 123.3

123.4
123.40000000000001

> Onward through the fog.

Consider this a lighthouse.

Paul




More information about the Python-list mailing list