pub trait UncheckedPow<Exp = Self> {
type Output;
// Required method
const fn unchecked_pow(self, exp: Exp) -> Self::Output;
}
Expand description
Raises self
to the power of exp
without checking for overflow or invalid input.
§Panics
Panics on overflow or if exp
is negative and self
is zero.
Required Associated Types§
Required Methods§
const fn unchecked_pow(self, exp: Exp) -> Self::Output
Implementors§
Source§impl UncheckedPow<i32> for Dec19x19
check! ( [Dec19x19::unchecked_pow, Dec19x19::checked_pow] {
// Identity and basic powers
(Dec19x19!(2), 0_i32) => Dec19x19!(1),
(Dec19x19!(2), 1_i32) => Dec19x19!(2),
(Dec19x19!(2), 3_i32) => Dec19x19!(8),
(Dec19x19!(2), 4_i32) => Dec19x19!(16),
(Dec19x19!(2), 5_i32) => Dec19x19!(32),
(Dec19x19!(2), 6_i32) => Dec19x19!(64),
(Dec19x19!(2), 7_i32) => Dec19x19!(128),
(Dec19x19!(2), 8_i32) => Dec19x19!(256),
(Dec19x19!(2), 9_i32) => Dec19x19!(512),
(Dec19x19!(2), 10_i32) => Dec19x19!(1024),
(Dec19x19!(2), 11_i32) => Dec19x19!(2048),
(Dec19x19!(2), 12_i32) => Dec19x19!(4096),
(Dec19x19!(2), 13_i32) => Dec19x19!(8192),
(Dec19x19!(2), 14_i32) => Dec19x19!(16384),
(Dec19x19!(2), 15_i32) => Dec19x19!(32768),
(Dec19x19!(2), 16_i32) => Dec19x19!(65536),
// Zero exponent
(Dec19x19!(20), 0) => Dec19x19!(1),
// Negative exponents
(Dec19x19!(2), -1_i32) => Dec19x19!(0.5),
(Dec19x19!(2), -2_i32) => Dec19x19!(0.25),
// Fractional bases
(Dec19x19!(0.5), 2_i32) => Dec19x19!(0.25),
(Dec19x19!(0.5), 3_i32) => Dec19x19!(0.125),
(Dec19x19!(0.5), -1_i32) => Dec19x19!(2.0),
// Fractional result rounding
(Dec19x19!(1.1), 2_i32) => Dec19x19!(1.21),
(Dec19x19!(1.5), 2_i32) => Dec19x19!(2.25),
// Larger integer base
(Dec19x19!(10), 3_i32) => Dec19x19!(1000),
(Dec19x19::MAX, -1_i32) => Dec19x19!(0),
(Dec19x19!(2), 63_i32) => Dec19x19!(9_223_372_036_854_775_808),
(Dec19x19!(2), 64) => FAIL,
(Dec19x19!(0), -1_i32) => FAIL,
(Dec19x19::MAX, 2_i32) => FAIL,
(Dec19x19::MIN, 2_i32) => FAIL,
});
impl UncheckedPow<i32> for Dec19x19
check! ( [Dec19x19::unchecked_pow, Dec19x19::checked_pow] {
// Identity and basic powers
(Dec19x19!(2), 0_i32) => Dec19x19!(1),
(Dec19x19!(2), 1_i32) => Dec19x19!(2),
(Dec19x19!(2), 3_i32) => Dec19x19!(8),
(Dec19x19!(2), 4_i32) => Dec19x19!(16),
(Dec19x19!(2), 5_i32) => Dec19x19!(32),
(Dec19x19!(2), 6_i32) => Dec19x19!(64),
(Dec19x19!(2), 7_i32) => Dec19x19!(128),
(Dec19x19!(2), 8_i32) => Dec19x19!(256),
(Dec19x19!(2), 9_i32) => Dec19x19!(512),
(Dec19x19!(2), 10_i32) => Dec19x19!(1024),
(Dec19x19!(2), 11_i32) => Dec19x19!(2048),
(Dec19x19!(2), 12_i32) => Dec19x19!(4096),
(Dec19x19!(2), 13_i32) => Dec19x19!(8192),
(Dec19x19!(2), 14_i32) => Dec19x19!(16384),
(Dec19x19!(2), 15_i32) => Dec19x19!(32768),
(Dec19x19!(2), 16_i32) => Dec19x19!(65536),
// Zero exponent
(Dec19x19!(20), 0) => Dec19x19!(1),
// Negative exponents
(Dec19x19!(2), -1_i32) => Dec19x19!(0.5),
(Dec19x19!(2), -2_i32) => Dec19x19!(0.25),
// Fractional bases
(Dec19x19!(0.5), 2_i32) => Dec19x19!(0.25),
(Dec19x19!(0.5), 3_i32) => Dec19x19!(0.125),
(Dec19x19!(0.5), -1_i32) => Dec19x19!(2.0),
// Fractional result rounding
(Dec19x19!(1.1), 2_i32) => Dec19x19!(1.21),
(Dec19x19!(1.5), 2_i32) => Dec19x19!(2.25),
// Larger integer base
(Dec19x19!(10), 3_i32) => Dec19x19!(1000),
(Dec19x19::MAX, -1_i32) => Dec19x19!(0),
(Dec19x19!(2), 63_i32) => Dec19x19!(9_223_372_036_854_775_808),
(Dec19x19!(2), 64) => FAIL,
(Dec19x19!(0), -1_i32) => FAIL,
(Dec19x19::MAX, 2_i32) => FAIL,
(Dec19x19::MIN, 2_i32) => FAIL,
});