Skip to main content

Numeric functions

5 functions on this page

Int floor(Float)

Rounds a floating point number down to the next lowest integer.

Float
the number to round.
returns
An integer.
Example
wdl
Int three = floor(3.14)
# `three` now contains `3`.

Int ceil(Float)

Rounds a floating point number up to the next highest integer.

Float
the number to round.
returns
An integer.
Example
wdl
Int four = ceil(3.14)
# `four` now contains `4`.

Int round(Float)

Rounds a floating point number to the nearest integer based on standard rounding rules ("round half up").

Float
the number to round.
returns
An integer.
Example
wdl
Int three = round(3.14)
# `three` now contains `3`.

Int min(Int, Int)Float min(Int, Float)Float min(Float, Int)Float min(Float, Float)

Returns the smaller of two values. If both values are Ints, the return value is an Int, otherwise it is a Float.

Int|Float
the first number to compare.
Int|Float
the second number to compare.
returns
The smaller of the two arguments.
Example
wdl
Int value1
Float value2

Float result = min(value1, value2)
# This is equivalent to `if value1 < value2 then value1 else value2`.

Int max(Int, Int)Float max(Int, Float)Float max(Float, Int)Float max(Float, Float)

Returns the larger of two values. If both values are Ints, the return value is an Int, otherwise it is a Float.

Int|Float
the first number to compare.
Int|Float
the second number to compare.
returns
The larger of the two arguments.
Example
wdl
Int value1
Float value2

Float result = max(value1, value2)
# This is equivalent to `if value1 > value2 then value1 else value2`.