Skip to content

Instantly share code, notes, and snippets.

@linzhp
Created July 16, 2012 06:09
Show Gist options
  • Save linzhp/3121026 to your computer and use it in GitHub Desktop.
Save linzhp/3121026 to your computer and use it in GitHub Desktop.
def max a, b
diff = a - b
[b, a][(diff / diff.abs + 1) / 2]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment