[][src]Trait fixed_exp::FixedPowI

pub trait FixedPowI: Fixed {
    fn powi(self, n: i32) -> Self;
}

Extension trait providing integer exponentiation for fixed-point numbers.

Required methods

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));
Loading content...

Implementations on Foreign Types

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

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

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

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

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

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

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

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

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

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

Loading content...

Implementors

Loading content...