Skip to content

Instantly share code, notes, and snippets.

@soc

soc/cmp.ml Secret

Last active December 16, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soc/455aa2be8250537da3b5b3ac1d13578e to your computer and use it in GitHub Desktop.
Save soc/455aa2be8250537da3b5b3ac1d13578e to your computer and use it in GitHub Desktop.
fun cmp(x: Double, y: Double) =
let l = x.asLong
let m = y.asLong
let ls = l.sign
let ms = m.sign
if (ls == ms)
if (ls != -1)
l.compareTo(m)
else
m.compareTo(l)
else if (l <= 0)
l.compareTo(m)
else
m.compareTo(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment