OxL Reference

method f64.trunc

The integer part as a float: rounds toward zero.

Example:

oxl✓ checked in CI
fn main() io {
  let x: f64 = -2.7
  print("{x.trunc()}")
}
Output
-2.0
pub(api) fn trunc() -> f64

Complexity. O(1).

Since. 1.0.0-beta

Returns

f64

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/numbers.oxl:4013

See also