O'Reilly logo
  • Yan Ren thinks this is interesting:

signum

From

Cover of Scala for the Impatient, Second Edition

Note

scala> def signum (num: Int) = if (num < 0) -1 else if (num == 0) 0 else 1 signum: (num: Int)Int