Kaydet (Commit) d2364e8e authored tarafından Tim Peters's avatar Tim Peters

SF bug #477221: abs and divmod act oddly with -0.0.

Partial fix.
float_abs():  ensure abs(-0.0) returns +0.0.
Bugfix candidate.
üst 3808045d
...@@ -570,8 +570,10 @@ float_abs(PyFloatObject *v) ...@@ -570,8 +570,10 @@ float_abs(PyFloatObject *v)
{ {
if (v->ob_fval < 0) if (v->ob_fval < 0)
return float_neg(v); return float_neg(v);
else else if (v->ob_fval > 0)
return float_pos(v); return float_pos(v);
else /* ensure abs(-0) is +0 */
return PyFloat_FromDouble(+0.0);
} }
static int static int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment