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.
See this snippet for a basic implementation of the square root using the Newton-Raphson method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With