Floor v0.1.0

Source
Rounds down to the nearest integer value.

Package: Math

Signature

func Floor(x: float64) -> float64;
func Floor(x: float32) -> float32;

Parameters

NameTypeDescription
xfloat64 / float32The value to round.

Returns

The largest integer value at or below x, still represented as a floating-point number. Floor(-0.0) is -0.0 and Floor(-Inf) is -Inf; a NaN passes through unchanged.

Example

import Math::Floor;

func Main() -> int {
    let a = Floor(3.7);  // 3.0
    let b = Floor(-3.2); // -4.0
    return 0;
}

See also

  • Math — the package overview
  • Ceil — round up
  • Round — round to the nearest integer
  • Trunc — round toward zero