import scala.math._
scala.math.Pi // 3.141592653589793
scala.math.E // 2.718281828459045
// numerical operations
scala.math.abs(-20) // 20
scala.math.pow(2, 3) // 8.0
scala.math.floor(2.945) // 2.0
scala.math.exp(1) // 2.718281828459045
scala.math.sqrt(16) // 4.0
// example
scala.math.sin(4 * math.Pi / 180) // 0.0697564737441253
// rounding values
scala.math.round(2.945) // 3
scala.math.round(2.495) // 2
// or
scala.math.rint(2.945 * 100) / 100 // 2.94
// find more at https://www.scala-lang.org/api/2.12.3/scala/math/index.html
Updated on May 27, 2023 Changelog