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

## fract

# Function fract

Source

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

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

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

## §Examples

    #![feature(core_float_math)]

    use core::f32;

    let x = 3.6_f32;
    let y = -3.6_f32;
    let abs_difference_x = (f32::math::fract(x) - 0.6).abs();
    let abs_difference_y = (f32::math::fract(y) - (-0.6)).abs();

    assert!(abs_difference_x <= f32::EPSILON);
    assert!(abs_difference_y <= f32::EPSILON);

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