fn div_by_stripped(mut a: BigUint, b: &BigUint) -> BigUint {
	a.lstrip();

	if b.len() == 0 {
		log::error!("Computation error: Invalid division");
		return BigUint::zero()
	}

	if b.len() == 1 {
		return a.div_unit(b.checked_get(0).unwrap_or(1))
	}

	if b.len() > a.len() {
		return BigUint::zero()
	}

	if b.len() == a.len() {
		// 100_000^2 is more than 2^32-1, thus `new_a` has more limbs than `b`.
		let mut new_a = a.mul(&BigUint::from(100_000u64.pow(2)));
		new_a.lstrip();

		debug_assert!(new_a.len() > b.len());
		return new_a
			.div(b, false)
			.map(|res| res.0)
			.unwrap_or_else(|| BigUint::zero())
			.div_unit(100_000)
			.div_unit(100_000)
	}

	a.div(b, false).map(|res| res.0).unwrap_or_else(|| BigUint::zero())
}
/// Compute a div b.
///
/// requires `b` to be stripped and have no leading zeros.
Compute a div b.
requires `b` to be stripped and have no leading zeros.
Compute a div b . requires ` b ` to be stripped and have no leading zeros .
fn div_by_stripped(mut a: BigUint, b: &BigUint) -> BigUint {
	a.lstrip();
	if b.len() == 0 {
		log::error!("Computation error: Invalid division");
		return BigUint::zero()
	}
	if b.len() == 1 {
		return a.div_unit(b.checked_get(0).unwrap_or(1))
	}
	if b.len() > a.len() {
		return BigUint::zero()
	}
	if b.len() == a.len() {
		// 100_000^2 is more than 2^32-1, thus `new_a` has more limbs than `b`.
		let mut new_a = a.mul(&BigUint::from(100_000u64.pow(2)));
		new_a.lstrip();
		debug_assert!(new_a.len() > b.len());
		return new_a
			.div(b, false)
			.map(|res| res.0)
			.unwrap_or_else(|| BigUint::zero())
			.div_unit(100_000)
			.div_unit(100_000)
	}
	a.div(b, false).map(|res| res.0).unwrap_or_else(|| BigUint::zero())
}
fn div_by_stripped ( mut a : BigUint , b : & BigUint ) -> BigUint { a . lstrip ( ) ; if b . len ( ) == 0 { log :: error ! ( " " ) ; return BigUint :: zero ( ) } if b . len ( ) == 1 { return a . div_unit ( b . checked_get ( 0 ) . unwrap_or ( 1 ) ) } if b . len ( ) > a . len ( ) { return BigUint :: zero ( ) } if b . len ( ) == a . len ( ) { // 100_000^2 is more than 2^32-1, thus `new_a` has more limbs than `b`. let mut new_a = a . mul ( & BigUint :: from ( 100_000u64 . pow ( 2 ) ) ) ; new_a . lstrip ( ) ; debug_assert ! ( new_a len ( ) b len ( ) ) ; return new_a . div ( b , false ) . map ( | res | res . 0 ) . unwrap_or_else ( | | BigUint :: zero ( ) ) . div_unit ( 100_000 ) . div_unit ( 100_000 ) } a . div ( b , false ) . map ( | res | res . 0 ) . unwrap_or_else ( | | BigUint :: zero ( ) ) }
Compute a div b.
requires `b` to be stripped and have no leading zeros.
Compute a div b . requires ` b ` to be stripped and have no leading zeros .
a
BigUint
b
&BigUint
a
BigUint
b
&BigUint