Closed
Description
It takes some large exponents and the overflow behavior is not documented nor coded:
/// Raises self to the power of `exp`, using exponentiation by squaring.
///
/// # Example
///
/// ```rust
/// use std::num::Int;
///
/// assert_eq!(2.pow(4), 16);
/// ```
#[unstable(feature = "core",
reason = "pending integer conventions")]
#[inline]
fn pow(self, mut exp: uint) -> Self {
let mut base = self;
let mut acc: Self = Int::one();
while exp > 0 {
if (exp & 1) == 1 {
acc = acc * base;
}
base = base * base;
exp /= 2;
}
acc
}
Metadata
Metadata
Assignees
Labels
No labels