Op 2005-09-13, Robert Kern schreef <[EMAIL PROTECTED]>:
> Jeremy Sanders wrote:
>> Nils Grimsmo wrote:
>> 
>>>Why did round() change in Python 2.4?
>> 
>> It the usual floating point representation problem. 0.0225 cannot be
>> represented exactly:
>
> That's not what he's asking about. He's asking why his Python 2.3 rounds
> 0.0225 *up* to 0.023 while his Python 2.4 rounds *down* to 0.022. It's
> the change in behavior that he's concerned with and isn't just the usual
> floating point problem.

I would say the usual floating point problem is involved.

Python 2.3 isn't rounding 0.0225 up while pyton 2.4 rounds it down.

0.0225 isn't representable and it happens that the actual number
you get differ. Now which number python should choose when it is
fed 0.0225, I don't know. But expressing the different behaviour
as a change in round, suggest that the O.P. would be wise to
learn about floating point problems

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to