Function num::pow [-] [+] [src]

pub fn pow<T: Clone + One + Mul<T, Output=T>>(base: T, exp: usize) -> T

Raises a value to the power of exp, using exponentiation by squaring.

Example

extern crate num; fn main() { use num; assert_eq!(num::pow(2i8, 4), 16); assert_eq!(num::pow(6u8, 3), 216); }
use num;

assert_eq!(num::pow(2i8, 4), 16);
assert_eq!(num::pow(6u8, 3), 216);