Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

fast_sqrt

Calculate the sqrt(x)

Arguments

  • x - The number to calculate the sqrt of
  • iter - The number of iterations to run the algorithm

Returns

  • u128 - The sqrt of x with rounding (e.g., sqrt(5) = 2.24 -> 2, sqrt(7) = 2.65 -> 3)

Fully qualified path: alexandria_math::fast_root::fast_sqrt

pub fn fast_sqrt(x: u128, iter: u32) -> u128