[ python-Bugs-1571620 ] round() producing -0.0

SourceForge.net noreply at sourceforge.net
Thu Oct 5 20:39:22 CEST 2006


Bugs item #1571620, was opened at 2006-10-05 13:14
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1571620&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Ron Frye (rrfsf01)
Assigned to: Nobody/Anonymous (nobody)
Summary: round() producing -0.0

Initial Comment:
python 2.2 on AIX 4.3 produces:

>>> round(-0.0001, 1)
0.0
>>>


python 2.4.1 on Linux Red Hat Enterprise 3 produces:

>>> round(-0.0001, 1)
-0.0
>>> round(-0.0001, 1) == 0.0
True
>>>


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2006-10-05 13:39

Message:
Logged In: YES 
user_id=80475

Since 0.0 == -0.0, the result in not wrong.  The underlying
C math library dictates whether signed zeroes are used, so
round(-0.0001, 1) returns the same result as 
math.ceil(-0.0001 * 10).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1571620&group_id=5470


More information about the Python-bugs-list mailing list