Function fixed_trigonometry::powi
source · [−]Expand description
Rase fixed number to an integer-valued power.
base^power.
Arguments
base- The base number.power- The power to raise ‘base’ to.
Example
use fixed_trigonometry::*;
use fixed::{types::extra::U22, FixedI32};
let mut x = FixedI32::<U22>::from_num(-2);
let y = powi(x, 2);
assert_eq!{ y.to_num::<f32>(), 4.0 };
let y = powi(x, 0);
assert_eq!{ y.to_num::<f32>(), 1.0 };