next up previous
Next: Equality Up: Loop Optimizations Previous: Loops

Trichotomy

 a<b or a>b or a=b
for any two ordinary numbers. But either a or b being a NaN means they are all false.
  if (a>b) then x else y   is NOT THE SAME as 
  if (a<=b) then y else x

The kinds of branching and loop exits that are compiled must respect the NaN. Many, if not all, compiler books routinely suggest rearrangement of inequalities and Boolean conditions containing them, based on trichotomy. The tradition continues even today with new books that are in other respects authoritative.



Richard J. Fateman
Thu Aug 13 13:55:33 PDT 1998