Function rationalize::continued_fraction_expansion
source · pub fn continued_fraction_expansion<const N: usize>(
n: f64,
min: f64
) -> [usize; N]
Expand description
Expand a float to a continued fraction expansion
Arguments
n
: The float to expandmin
: Numbers less than this value are treated as zero
returns: [usize; N] where N is the number of terms in the expansion
Examples
let cfe = continued_fraction_expansion::<10>(std::f64::consts::PI, 1e-10);
assert_eq!(cfe, [3, 7, 15, 1, 292, 1, 1, 1, 2, 1]);