Skip to content

abs

In std/math.

fn abs(self: Int) : Int
fn abs(self: Float) : Float
fn abs(self: Decimal) : Decimal
fn abs(self: Duration) : Duration

self without its sign, at its own type: abs(-3) is 3, abs(-1.50) is 1.50, and abs(Duration("-PT1H")) is PT1H. The least Int and the least Duration have no positive counterpart, and their abs is an overflow error.