Tracy R Reed wrote:
Chuck Esterbrook wrote:
One of my test cases even reads:
assert .1+.1+.1+.1+.1+.1+.1+.1+.1+.1 == 1.0
Which fails in most languages including Python.
>>> assert .1+.1+.1+.1+.1+.1+.1+.1+.1+.1 == 1.0
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AssertionError
>>> print .1+.1+.1+.1+.1+.1+.1+.1+.1+.1
1.0
They both appear to come out to 1.0. Is the print statement doing some
rounding as well or something?
Yes.
>>> a = .1+.1+.1+.1+.1+.1+.1+.1+.1+.1
>>> print "%f" % a
1.000000
>>> print "%1.20f" % a
0.99999999999999988898
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg