This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: round() producing -0.0
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, rrfsf01
Priority: normal Keywords:

Created on 2006-10-05 18:14 by rrfsf01, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg30167 - (view) Author: Ron Frye (rrfsf01) Date: 2006-10-05 18:14
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
>>>
msg30168 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2006-10-05 18:39
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).
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44087
2006-10-05 18:14:45rrfsf01create