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

## powi

# Function powi

Source

    pub fn powi(x: f32, n: i32) -> f32

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

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

## §Examples

    #![feature(core_float_math)]

    use core::f32;

    let x = 2.0_f32;
    let abs_difference = (f32::math::powi(x, 2) - (x * x)).abs();
    assert!(abs_difference <= 1e-5);

    assert_eq!(f32::math::powi(f32::NAN, 0), 1.0);

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