summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-01-06 23:59:26 +0000
committerrodri <rgl@antares-labs.eu>2024-01-06 23:59:26 +0000
commit9a7852993c538212d5e14aa34c49ba7d990aca76 (patch)
treeb319d61b2b7d3b5ea7fe3711ed829512a65bad72
parent97f4b9b97c470501d25ac82cad771bdff75e9b59 (diff)
downloadbrokentoys-9a7852993c538212d5e14aa34c49ba7d990aca76.tar.gz
brokentoys-9a7852993c538212d5e14aa34c49ba7d990aca76.tar.bz2
brokentoys-9a7852993c538212d5e14aa34c49ba7d990aca76.zip
sqrt.c: add forgotten comments.
-rw-r--r--sqrt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sqrt.c b/sqrt.c
index 5a78693..281e73e 100644
--- a/sqrt.c
+++ b/sqrt.c
@@ -32,7 +32,11 @@ double
return 0;
x0 = -1;
- x = n > 1? n/2: 1;
+ x = n > 1? n/2: 1; /* initial estimate */
+ /*
+ * take advantage of the computer's discreteness
+ * to get the most accurate result.
+ */
while(x0 != x){
x0 = x;
x = 0.5*(x0 + n/x0);