commit
52e2afa304
|
@ -372,7 +372,7 @@ impl Rem<BigUint, BigUint> for BigUint {
|
|||
|
||||
impl Neg<BigUint> for BigUint {
|
||||
#[inline]
|
||||
fn neg(&self) -> BigUint { fail!() }
|
||||
fn neg(&self) -> BigUint { panic!() }
|
||||
}
|
||||
|
||||
impl CheckedAdd for BigUint {
|
||||
|
@ -428,7 +428,7 @@ impl Integer for BigUint {
|
|||
}
|
||||
|
||||
fn div_mod_floor(&self, other: &BigUint) -> (BigUint, BigUint) {
|
||||
if other.is_zero() { fail!() }
|
||||
if other.is_zero() { panic!() }
|
||||
if self.is_zero() { return (Zero::zero(), Zero::zero()); }
|
||||
if *other == One::one() { return ((*self).clone(), Zero::zero()); }
|
||||
|
||||
|
@ -838,7 +838,7 @@ fn get_radix_base(radix: uint) -> (DoubleBigDigit, uint) {
|
|||
14 => (1475789056, 8),
|
||||
15 => (2562890625, 8),
|
||||
16 => (4294967296, 8),
|
||||
_ => fail!("The radix must be within (1, 16]")
|
||||
_ => panic!("The radix must be within (1, 16]")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ impl Integer for BigInt {
|
|||
let d = BigInt::from_biguint(Plus, d_ui);
|
||||
let r = BigInt::from_biguint(Plus, r_ui);
|
||||
match (self.sign, other.sign) {
|
||||
(_, NoSign) => fail!(),
|
||||
(_, NoSign) => panic!(),
|
||||
(Plus, Plus) | (NoSign, Plus) => ( d, r),
|
||||
(Plus, Minus) | (NoSign, Minus) => (-d, r),
|
||||
(Minus, Plus) => (-d, -r),
|
||||
|
@ -1119,7 +1119,7 @@ impl Integer for BigInt {
|
|||
let d = BigInt::from_biguint(Plus, d_ui);
|
||||
let m = BigInt::from_biguint(Plus, m_ui);
|
||||
match (self.sign, other.sign) {
|
||||
(_, NoSign) => fail!(),
|
||||
(_, NoSign) => panic!(),
|
||||
(Plus, Plus) | (NoSign, Plus) => (d, m),
|
||||
(Plus, Minus) | (NoSign, Minus) => if m.is_zero() {
|
||||
(-d, Zero::zero())
|
||||
|
@ -2131,7 +2131,7 @@ mod biguint_tests {
|
|||
(10, match bits {
|
||||
32 => "8589934593".to_string(),
|
||||
16 => "131073".to_string(),
|
||||
_ => fail!()
|
||||
_ => panic!()
|
||||
}),
|
||||
(16,
|
||||
format!("2{}1", "0".repeat(bits / 4 - 1)))
|
||||
|
@ -2147,7 +2147,7 @@ mod biguint_tests {
|
|||
(10, match bits {
|
||||
32 => "55340232229718589441".to_string(),
|
||||
16 => "12885032961".to_string(),
|
||||
_ => fail!()
|
||||
_ => panic!()
|
||||
}),
|
||||
(16,
|
||||
format!("3{}2{}1",
|
||||
|
@ -2206,7 +2206,7 @@ mod biguint_tests {
|
|||
fn check(n: uint, s: &str) {
|
||||
let n = factor(n);
|
||||
let ans = match FromStrRadix::from_str_radix(s, 10) {
|
||||
Some(x) => x, None => fail!()
|
||||
Some(x) => x, None => panic!()
|
||||
};
|
||||
assert_eq!(n, ans);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ impl<T: Clone + Integer + PartialOrd>
|
|||
#[inline]
|
||||
pub fn new(numer: T, denom: T) -> Ratio<T> {
|
||||
if denom == Zero::zero() {
|
||||
fail!("denominator == 0");
|
||||
panic!("denominator == 0");
|
||||
}
|
||||
let mut ret = Ratio::new_raw(numer, denom);
|
||||
ret.reduce();
|
||||
|
|
Loading…
Reference in New Issue