floor

Round down

Definition

int floor(number $value)

Returns the greatest integer that is less or equal to $value.

Parameters

number $value

The value to calculate the floor of.

Returns

int

The greatest integer that is less or equal to $value.

Examples

{
    a: floor(`1.001`),
    b: floor(`-1.001`),
    c: floor(`1`),
    d: floor(`true`),
    e: floor(`null`)      // Error
}
{
  "a": 1,
  "b": -2,
  "c": 1,
  "d": 1
}