in reply to Finding the max()/min()
Here's an interesting one that doesn involve a comparison operator (even an obfuscated one):
The math behind that is: take the average of the two numbers, and then add half their difference (start half-way between, and then go up by half). So: (x+y)/2 + abs(x-y)/2, and then factor out the division by two.($x + $y + abs($x - $y)) / 2
------------ :Wq Not an editor command: Wq
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Finding the max()/min()
by benizi (Hermit) on Nov 12, 2004 at 21:58 UTC | |
by etcshadow (Priest) on Nov 12, 2004 at 22:12 UTC | |
by Anonymous Monk on Dec 12, 2023 at 22:18 UTC |
In Section
Meditations