Skip to content

Instantly share code, notes, and snippets.

@yeliu84
Created January 19, 2011 07:39
Show Gist options
  • Save yeliu84/785830 to your computer and use it in GitHub Desktop.
Save yeliu84/785830 to your computer and use it in GitHub Desktop.
Find max and min of two numbers without using comparison
max = (a + b + abs(a - b)) / 2
min = (a + b - abs(a - b)) / 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment