Skip to content
Prev Previous commit
Next Next commit
rename function
  • Loading branch information
Ken Power committed Oct 4, 2018
commit 5f761e5332b6664eaa671bdc90e8eb75d29510fd
6 changes: 3 additions & 3 deletions contents/euclidean_algorithm/code/scala/euclidean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ object Euclid {
}

def euclid_mod(a: Int, b: Int): Int =
b match {
case 0 => a
case _ => euclid_mod(b, a % b)
(Math.abs(a), Math.abs(b)) match {
case (_, 0) => a
case (a, b) => euclid_mod(b, a % b)
}

def main(args: Array[String]): Unit = {
Expand Down