Reputation:
I know that one can use the sqrt function in libc/math for doing it:
staload
Math =
"libats/libc/SATS/math.sats"
val sqrt2 = $Math.sqrt(2.0)
val sqrt3 = $Math.sqrt(3.0)
I am looking for a direct implementation of sqrt in ATS if possible.
Upvotes: 3
Views: 126
Reputation: 4006
See this snippet for a basic implementation of the square root using the Newton-Raphson method.
Upvotes: 1