[Python-bugs-list] [ python-Bugs-477221 ] abs and divmod act oddly with -0.0

noreply@sourceforge.net noreply@sourceforge.net
Thu, 01 Nov 2001 10:40:44 -0800


Bugs item #477221, was opened at 2001-11-01 10:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=477221&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: abs and divmod act oddly with -0.0

Initial Comment:
Python 2.1.1 (#97, Aug  2 2001, 21:53:31)  [CW PPC GUSI2 THREADS] on mac
Type "copyright", "credits" or "license" for more information.
>>> abs(-1.0)
1.0
>>> abs(-0.0)
-0.0
>>> divmod(-0.0, 1.0)
(0.0, -0.0)

The same thing happens on a unix Python 2.0, so I think it's pretty generic. I hope folks think it's a bug, not a feature, and worth fixing. It bit me when trying to write a sexagesimal formatter -- output that should have shown -0:00:00 showed 0:00:-0 instead.

-- Russell

Russell Owen
owen@astro.washington.edu


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

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