Function powi

Source
pub fn powi(x: f64, n: i32) -> f64
🔬This is a nightly-only experimental API. (core_float_math)
Expand description

Experimental version of powi in core. See f64::powi for details.

§Examples

#![feature(core_float_math)]

use core::f64;

let x = 2.0_f64;
let abs_difference = (f64::powi(x, 2) - (x * x)).abs();
assert!(abs_difference <= f64::EPSILON);

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

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