lehmer_simulate

Function lehmer_simulate 

Source
fn lehmer_simulate(a: &BigInt, b: &BigInt) -> (u64, u64, u64, u64, bool)
Expand description

Attempts to simulate several Euclidean update steps using leading digits of a and b. It returns u0, u1, v0, v1 such that a and b can be updated as: a = u0 * a + v0 * b b = u1 * a + v1 * b

Requirements: a >= b and b.len() > 2. Since we are calculating with full words to avoid overflow, even (the returned bool) is used to track the sign of cosequences. For even iterations: u0, v1 >= 0 && u1, v0 <= 0 For odd iterations: u0, v1 <= && u1, v0 >= 0