On 20 Nov, 06:01, srinivasan srinivas <[EMAIL PROTECTED]> wrote:
> Yes it works for most of the cases.  But it doesn't for the following case:
>
> >>> str(abs(int(1234567.89)-1234567.89))
>
> '0.889999999898'

Well, that is 0.89 or about as near to it as the calculation can
represent. Like other numbers 0.89 evidently cannot be exactly
represented as a float in binary. The nearest number above it is

>>> 0.89
0.89000000000000001
>>>

This is not a Python issue but a result of storing numbers in floating
binary form.

BTW, please post comments below existing ones rather than above them.
It is more familiar on Usenet and, as a consequence, easier to read.

James
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to