BUG: A wrong result of computation in python2.6
version: Python 2.6 OS : Windows 7
The variable x below should have been 10(integer) after the expression evaluates. It ,however, gets the value 10.000000000000002 (float) , as follows, 
x=math.exp ( math.log(10.0)) x
10.000000000000002
x=math.exp ( math.log(10)) x
10.000000000000002 
In mathematics, the result is not right.
Hi Matthew, thanks for your email.
On Wed, Feb 16, 2011 at 05:47, matthew chao mathewchao@gmail.com wrote:
version: Python 2.6 OS : Windows 7
The variable x below should have been 10(integer) after the expression evaluates. It ,however, gets the value 10.000000000000002 (float) , as follows,
x=math.exp ( math.log(10.0)) x
10.000000000000002
x=math.exp ( math.log(10)) x
10.000000000000002
In mathematics, the result is not right.
I could try to explain why this is "expected" on a computer, but I could never do it even near as good as David Goldberg in his famous paper "what every scientist should know about floatingpoint arithmetic"[1]
[1] http://cr.yp.to/2005590/goldberg.pdf
Cheers,
participants (2)

matthew chao

Sandro Tosi