Functions operating on numbers

The following functions supplement the built-in operators on numbers, like +, *, -, /.

Int::toFloat : Int -> Float

Converts an Int to a Float.

Examples

val a = Int::toFloat 4
//    = 4.0

Int::toString : Int -> String

Converts an Int to a String.

Examples

val a = Int::toString 4
//    = "4"

Math::abs : Int -> Int

Get the absolute value of an Int.

Examples

val a = Math::abs (10 - 15)
//    = 5
val b = Math::abs 8
//    = 8

Math::fabs : Float -> Float

Get the absolute value of a Float.

Examples

val a = Math::fabs (10.0 - 15.0)
//    = 5.0
val b = Math::fabs 8.0
//    = 8.0

Math::pow : Float -> Float -> Float

The power function: \(a^b\).

Examples

val a = Math::pow 4.0 3.0
//    = 64.0

Math::sqrt : Float -> Float

The square root function: \(\sqrt{a}\).

Examples

val a = Math::sqrt 9.0
      = 3.0