Most definitions of floating-point min
and max
are badly flawed; this note explains what axioms these functions should have, illustrates the problems with existing definitions, and explores the options for fixing the situation.
Note: min
and max
should be symmetric, so it suffices to restrict our attention to one of them. For most of the rest of this document, I'll explain everything using min
. The appropriate modifications to get max
should generally be pretty clear.
The first two axioms capture the meaning of minimum; they will likely seem completely obvious (possible the point of absurdity).