I have added three methods of finding the square root.
n1: The sqrt() function. I tried to find information about how it works but I’m not sure, but I thought I would include it so that I can compare my own methods with it.
n2: Integer testing, this method basically tries if an int to the power of two is bigger than the target number. And if so return that int, it isn’t very accurate but it’s fast.
n3: Integer testing for each number position. Does the same thing as number 2 but first guesses for the million number, then the hundred thousand number, then the ten thousand number, and so on until it gets 3 decimals of accuracy. A lot more precise than the second method and less looping for big numbers.
I also added a loading bar, ascii title, and an output for each method and now I’m gonna try to add FTXUI to make it look a lot prettier.
Log in to leave a comment