trunc in core::f32::math - Rust
Description: Experimental version of `trunc` in `core`. See `f32::trunc` for details.

## trunc

# Function trunc

Source

    pub const fn trunc(x: f32) -> f32

🔬This is a nightly-only experimental API. (`core_float_math` #137578)
Expand description

Experimental version of `trunc` in `core`. See `f32::trunc` for details.

## §Examples

    #![feature(core_float_math)]

    use core::f32;

    let f = 3.7_f32;
    let g = 3.0_f32;
    let h = -3.7_f32;

    assert_eq!(f32::math::trunc(f), 3.0);
    assert_eq!(f32::math::trunc(g), 3.0);
    assert_eq!(f32::math::trunc(h), -3.0);

This standalone function is for testing only. It will be stabilized as an inherent method.