# Function fract

Source

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

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

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

## §Examples

    #![feature(core_float_math)]

    use core::f64;

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

    assert!(abs_difference_x < 1e-10);
    assert!(abs_difference_y < 1e-10);

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