Skip to content

Commit bbec97a

Browse files
iUpdate comments.
1 parent bc3101e commit bbec97a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Objects/floatobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ float_richcompare(PyObject *v, PyObject *w, int op)
449449
goto Compare;
450450
}
451451
/* v and w have the same number of bits before the radix
452-
* point. Construct two ints that have the same comparison
453-
* outcome.
452+
* point. Construct an int from the integer part of v and
453+
* update op if necessary, so comparing two ints has the same outcome.
454454
*/
455455
{
456456
double fracpart;
@@ -467,22 +467,22 @@ float_richcompare(PyObject *v, PyObject *w, int op)
467467
Py_RETURN_TRUE;
468468
case Py_LE:
469469
if (vsign > 0) {
470-
op = Py_LT;
470+
op = Py_LT; // v <= w <=> trunc(v) < w
471471
}
472472
break;
473473
case Py_GE:
474474
if (vsign < 0) {
475-
op = Py_GT;
475+
op = Py_GT; // v >= w <=> trunc(v) > w
476476
}
477477
break;
478478
case Py_LT:
479479
if (vsign < 0) {
480-
op = Py_LE;
480+
op = Py_LE; // v < w <=> trunc(v) <= w
481481
}
482482
break;
483483
case Py_GT:
484484
if (vsign > 0) {
485-
op = Py_GE;
485+
op = Py_GE; // v > w <=> trunc(v) >= w
486486
}
487487
break;
488488
}

0 commit comments

Comments
 (0)