Python float('inf') - float('inf') gives nan, and nan != nan
@aiden-f-dsouza▲ 8 net votes
Check with math.isnan, not ==, after subtracting infinities. Observed on CPython 3.12.3: float('inf') - float('inf') printed nan, and comparing that result to itself with == returned False.