[][src]Function reikna::continued_fraction::square_root

pub fn square_root(x: u64) -> ContinuedFraction

Return a ContinuedFraction representing the square root of x.

This is an infinite continued fraction that should be expanded multiple times to obtain an accurate value.

If x is a perfect square, a ContinuedFraction will be returned containing the square root of x.

Examples

use reikna::continued_fraction::square_root;
assert_eq!(square_root(19), vec![4, 2, 1, 3, 1, 2, 8]);
assert_eq!(square_root(25), vec![5]);