Function powi

Source
pub fn powi(x: f32, n: i32) -> f32
🔬This is a nightly-only experimental API. (core_float_math)
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::powi(x, 2) - (x * x)).abs();
assert!(abs_difference <= f32::EPSILON);

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

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