At 06:01 AM 7/6/2008, Alan Gauld wrote:
"Dick Moores" <[EMAIL PROTECTED]> wrote
Traceback (most recent call last):
File "E:\PythonWork\Untitled 2.py", line 42, in <module>
assert(fact(10,4) == 3.629e+6)
AssertionError
I'm not sure but I suspect you are running into the dreaded floating
point precision problem.
You probably need to try:
result = 3.694e+6
e = result/1000000 # add zeros to suit!
assert(result - e < fact(10,4) < result + e)
Or somesuch
Just a guess though.
And a good one!
assert(result - e < fact(10,4) < result + e)
works with e = result/100000 but not with e = result/1000000 .
Thanks, Alan.
Dick
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor