mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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:
parent
3808045d00
commit
d2364e8e2d
1 changed files with 11 additions and 9 deletions
|
@ -570,8 +570,10 @@ float_abs(PyFloatObject *v)
|
|||
{
|
||||
if (v->ob_fval < 0)
|
||||
return float_neg(v);
|
||||
else
|
||||
else if (v->ob_fval > 0)
|
||||
return float_pos(v);
|
||||
else /* ensure abs(-0) is +0 */
|
||||
return PyFloat_FromDouble(+0.0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue