Calculates the simpler representation of numerator and denominator and
update both values with the resulting simplified fraction.
Simplify a fraction using a simple continued fraction decomposition.
The idea here is to convert fractions such as 333333/10000000 to 1/30
using 32 bit arithmetic only. The algorithm is not perfect and relies
upon two arbitrary parameters to remove non-significative terms from
the simple continued fraction decomposition. Using 8 and 333 for
n_terms and threshold respectively seems to give nice results.
Calculates the simpler representation of numerator and denominator and update both values with the resulting simplified fraction.
Simplify a fraction using a simple continued fraction decomposition. The idea here is to convert fractions such as 333333/10000000 to 1/30 using 32 bit arithmetic only. The algorithm is not perfect and relies upon two arbitrary parameters to remove non-significative terms from the simple continued fraction decomposition. Using 8 and 333 for n_terms and threshold respectively seems to give nice results.