-- Approximate the square root of a Double $x to at least the accuracy of $epsilon. squareRoot :: Double -> Double -> Double squareRoot x eps = loop x where loop :: Double -> Double loop y | abs( (y * y) - x ) <= eps = y | otherwise = loop (0.5 * (y + (x / y)))