+ 2

Square root implementation

I am trying to implement a square root function implementation. My code seems to work, except that it does not output the answer when I put a very large number as input. Any suggestions? https://code.sololearn.com/cgq8cbxmOqSp/#cpp

20th Aug 2020, 7:41 PM
Edward Finkelstein
Edward Finkelstein - avatar
2 odpowiedzi
+ 1
I fixed it!
20th Aug 2020, 8:48 PM
Edward Finkelstein
Edward Finkelstein - avatar
+ 1
Coder Kitten I changed my code so that the range depends on the function argument. It seems to be imprecise after the second decimal, and it doesn't seem to work for numbers between 0 and 1. I made this code because I was trying to understand how people who made sqrt() function implemented it. Maybe you know a better way?
20th Aug 2020, 8:55 PM
Edward Finkelstein
Edward Finkelstein - avatar