[issue4061] summing two numbers-strange answer

2008-10-06 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Mon, Oct 6, 2008 at 8:54 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > Raymond Hettinger <[EMAIL PROTECTED]> added the comment: > > FWIW, what you're seeing is related to "representation error" not "poor > precision". The numbers

[issue4061] summing two numbers-strange answer

2008-10-06 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: FWIW, what you're seeing is related to "representation error" not "poor precision". The numbers 2.3, 6.3, and 8.6 cannot be exactly represented in binary floating point. When you think about it, this is no more surprising than knowing the

[issue4061] summing two numbers-strange answer

2008-10-06 Thread Mehmet Yozcu
Mehmet Yozcu <[EMAIL PROTECTED]> added the comment: Dear Benjamin Peterson; Thank you very much for your answer. That was very helpful Best Wishes 2008/10/7 Benjamin Peterson <[EMAIL PROTECTED]>: > > Benjamin Peterson <[EMAIL PROTECTED]> added the comment: > > This is a result of poor floating-p

[issue4061] summing two numbers-strange answer

2008-10-06 Thread Mehmet Yozcu
Mehmet Yozcu <[EMAIL PROTECTED]> added the comment: Dear Victor Stinner; Thank you very much for your answer. That was very helpful Best Wishes 2008/10/7 STINNER Victor <[EMAIL PROTECTED]>: > > STINNER Victor <[EMAIL PROTECTED]> added the comment: > > Use Decimal to get an exact result: fro

[issue4061] summing two numbers-strange answer

2008-10-06 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: Use Decimal to get an exact result: >>> from decimal import Decimal >>> print Decimal('2.3') + Decimal('6.3') 8.6 -- nosy: +haypo ___ Python tracker <[EMAIL PROTECTED]>

[issue4061] summing two numbers-strange answer

2008-10-06 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: This is a result of poor floating-point precision: >>> 2.3 2.2998 >>> 6.3 6.2998 See http://docs.python.org/tutorial/floatingpoint.html for more information. -- nosy: +benjamin.peterson resolution: -> inv

[issue4061] summing two numbers-strange answer

2008-10-06 Thread Mehmet Yozcu
New submission from Mehmet Yozcu <[EMAIL PROTECTED]>: I don't know what's wrong but when I write on the IDLE 2.3+6.3 it gives an answer like 8.596 or similar when I write on the IDLE print 2.3+6.3 the answer is 8.6 as I expected I tried these two commands on the DrPython IDE;the result w