Expand description
A type operator that provides exponentiation by repeated squaring.
Example
use typenum::{Integer, Pow, N3, P3};
assert_eq!(<N3 as Pow<P3>>::Output::to_i32(), -27);
Associated Types
Required methods
This function isn’t used in this crate, but may be useful for others. It is implemented for primitives.
Example
use typenum::{Pow, U3};
let a = 7u32.powi(U3::new());
let b = 7u32.pow(3);
assert_eq!(a, b);
let x = 3.0.powi(U3::new());
let y = 27.0;
assert_eq!(x, y);
Implementations on Foreign Types
Implementors
sourceimpl<U> Pow<NInt<UInt<U, B0>>> for NInt<UInt<UTerm, B1>> where
U: Unsigned,
impl<U> Pow<NInt<UInt<U, B0>>> for NInt<UInt<UTerm, B1>> where
U: Unsigned,
(-1)^N = 1 if N is even
sourceimpl<U> Pow<NInt<UInt<U, B1>>> for NInt<UInt<UTerm, B1>> where
U: Unsigned,
impl<U> Pow<NInt<UInt<U, B1>>> for NInt<UInt<UTerm, B1>> where
U: Unsigned,
(-1)^N = -1 if N is odd
sourceimpl<Ul, Ur> Pow<PInt<UInt<Ur, B0>>> for NInt<Ul> where
Ul: Unsigned + NonZero + Pow<UInt<Ur, B0>>,
Ur: Unsigned,
<Ul as Pow<UInt<Ur, B0>>>::Output: Unsigned,
<Ul as Pow<UInt<Ur, B0>>>::Output: NonZero,
impl<Ul, Ur> Pow<PInt<UInt<Ur, B0>>> for NInt<Ul> where
Ul: Unsigned + NonZero + Pow<UInt<Ur, B0>>,
Ur: Unsigned,
<Ul as Pow<UInt<Ur, B0>>>::Output: Unsigned,
<Ul as Pow<UInt<Ur, B0>>>::Output: NonZero,
N(Ul)^P(Ur) = P(Ul^Ur) if Ur is even
sourceimpl<Ul, Ur> Pow<PInt<UInt<Ur, B1>>> for NInt<Ul> where
Ul: Unsigned + NonZero + Pow<UInt<Ur, B1>>,
Ur: Unsigned,
<Ul as Pow<UInt<Ur, B1>>>::Output: Unsigned,
<Ul as Pow<UInt<Ur, B1>>>::Output: NonZero,
impl<Ul, Ur> Pow<PInt<UInt<Ur, B1>>> for NInt<Ul> where
Ul: Unsigned + NonZero + Pow<UInt<Ur, B1>>,
Ur: Unsigned,
<Ul as Pow<UInt<Ur, B1>>>::Output: Unsigned,
<Ul as Pow<UInt<Ur, B1>>>::Output: NonZero,
N(Ul)^P(Ur) = N(Ul^Ur) if Ur is odd