Skip to content

Commit f4cd2f2

Browse files
Update Objects/floatobject.c
1 parent bbec97a commit f4cd2f2

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

Objects/floatobject.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,25 +465,13 @@ float_richcompare(PyObject *v, PyObject *w, int op)
465465
Py_RETURN_FALSE;
466466
case Py_NE:
467467
Py_RETURN_TRUE;
468-
case Py_LE:
469-
if (vsign > 0) {
470-
op = Py_LT; // v <= w <=> trunc(v) < w
471-
}
472-
break;
473-
case Py_GE:
474-
if (vsign < 0) {
475-
op = Py_GT; // v >= w <=> trunc(v) > w
476-
}
477-
break;
478468
case Py_LT:
479-
if (vsign < 0) {
480-
op = Py_LE; // v < w <=> trunc(v) <= w
481-
}
469+
case Py_LE:
470+
op = vsign > 0 ? Py_LT : Py_LE;
482471
break;
483472
case Py_GT:
484-
if (vsign > 0) {
485-
op = Py_GE; // v > w <=> trunc(v) >= w
486-
}
473+
case Py_GE:
474+
op = vsign > 0 ? Py_GE : Py_GT;
487475
break;
488476
}
489477
}

0 commit comments

Comments
 (0)