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

Partial fix.
float_abs():  ensure abs(-0.0) returns +0.0.
Bugfix candidate.
This commit is contained in:
Tim Peters 2001-11-01 20:09:42 +00:00
parent 3808045d00
commit d2364e8e2d

View file

@ -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