Trait FixedPowI

Source
pub trait FixedPowI: Fixed {
    // Required method
    fn powi(self, n: i32) -> Self;
}
Expand description

Extension trait providing integer exponentiation for fixed-point numbers.

Required Methods§

Source

fn powi(self, n: i32) -> Self

Raises a number to an integer power, using exponentiation by squaring.

Using this function is generally faster than using powf.

§Panics

Panics if 1 cannot be represented in Self, and n is non-positive.

§Examples
use fixed::types::I32F32;
use fixed_exp::FixedPowI;

let x = I32F32::from_num(4.0);
assert_eq!(I32F32::from_num(1024.0), x.powi(5));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Frac> FixedPowI for FixedI8<Frac>
where Frac: LeEqU8 + IsLessOrEqual<U6>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedI16<Frac>
where Frac: LeEqU16 + IsLessOrEqual<U14>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedI32<Frac>
where Frac: LeEqU32 + IsLessOrEqual<U30>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedI64<Frac>
where Frac: LeEqU64 + IsLessOrEqual<U62>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedI128<Frac>
where Frac: LeEqU128 + IsLessOrEqual<U126>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedU8<Frac>
where Frac: LeEqU8 + IsLessOrEqual<U7>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedU16<Frac>
where Frac: LeEqU16 + IsLessOrEqual<U15>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedU32<Frac>
where Frac: LeEqU32 + IsLessOrEqual<U31>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedU64<Frac>
where Frac: LeEqU64 + IsLessOrEqual<U63>,

Source§

fn powi(self, n: i32) -> Self

Source§

impl<Frac> FixedPowI for FixedU128<Frac>
where Frac: LeEqU128 + IsLessOrEqual<U127>,

Source§

fn powi(self, n: i32) -> Self

Implementors§