# Function sqrt

Source

    pub fn sqrt(x: f32) -> f32

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

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

## §Examples

    #![feature(core_float_math)]

    use core::f32;

    let positive = 4.0_f32;
    let negative = -4.0_f32;
    let negative_zero = -0.0_f32;

    assert_eq!(f32::math::sqrt(positive), 2.0);
    assert!(f32::math::sqrt(negative).is_nan());
    assert_eq!(f32::math::sqrt(negative_zero), negative_zero);

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