[][src]Function reikna::continued_fraction::expand_f64_ntimes

pub fn expand_f64_ntimes(fraction: &ContinuedFraction, n: u64) -> f64

Expand the continued fraction fraction n times, storing the result as an f64.

Finite fractions should be expanded with n = 1, infinite fractions should be expanded with an n large enough to gain the desired precision.

Note that is n is large or the continued fraction is very long, the f64s representing the numerator and denominator during the expansion may overflow.

Panics

Panics if n is zero or if fraction is empty.

Examples

use reikna::continued_fraction::expand_f64_ntimes;
println!("[1; 2] = {}", expand_f64_ntimes(&vec![1, 2], 1));
println!("[14] = {}", expand_f64_ntimes(&vec![14], 5));

Outputs:

[1; 2] = 1.2
[14] = 14