Skip to content

A program that tests various algorithms for mathematically producing the square root of a range of numbers

Notifications You must be signed in to change notification settings

PeterDessev/SquareRootAlgorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Square Root Algorithms

A testing program for several different methods of computing square roots in software.

Paper

The paper to go along with this program is available here:

https://docs.google.com/document/d/1aGCRhi2Cv1Dikgq-pWDK3uEog6NLN1r-RY6air4I0K4/edit?usp=sharing

While reading is not required to understand any of the program, it still offers insights into the math behind each algorithm, and anaylsis on the results

Build

To build the project use the make command in the project root directory

make

The program has been tested working on Ubuntu and Windows 10, but not MacOS

Overview of Algorithms and Testing

The algorithms in this paper are split into two categories

  • Estimate Production
  • Estimate Iteration

Each estimate producing algorithm is paired with every estimate iterating algorithm and given a set ammount of time to calculate the square root of the same number as many times as possible. Inputs are logarithmically dispersed across 21 powers of ten to allow for different algorithms to show where they are strong and where they are weak.

Algorithms that produce an estimate do not contain a loop. They have the same execution time for any input, and have no check for accuracy.

Algorithms that iterate on a guess function on a loop. The loop continually runs until a certain accuracy threshold is reached. Every method that iterates on a guess contains an almost identical check algorithm, so one algorithm does not get an advantage over another due to a check algorithm.

Estimate Production

  • One as an estimate
  • Input Over
  • Floating Point Estimation
  • Inverse Floating Point Estimation

Estimate Iteration

  • Babylonian Method
  • Goldschmidt Equations
  • Halley's Method
  • Newton's Method

Customization

Most of the testing parameters can be modified in the include/parameters.h and src/paraemters.c files

About

A program that tests various algorithms for mathematically producing the square root of a range of numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published