This is probably well known to everybody except me, but I've only recently encountered these functions to find the maximum and minimum of two numeric values without any comparison operators (less-than, greater-than etc.) being needed at all:
Code: Select all
DEF FNmax(a,b)=(a+b+ABS(a-b))/2
DEF FNmin(a,b)=(a+b-ABS(a-b))/2
Admittedly they are a little slower than the naïve approach using comparisons, but may nevertheless be of interest.