/sqrt

A library of simple and readable ANSI C implementations of some square root approximation algorithms

Primary LanguageCGNU Lesser General Public License v3.0LGPL-3.0

DESCRIPTION
-----------
This archive contains a simple and readable ANSI C implementation of some
square root approximation algorithms, including the algorithm used by the
original ENIAC computer, successive approximation, and bisection.  This
implementation is not intended to be the best, fastest, smallest, or any
other performance related adjective.

There are other known algorithms that are much faster than these algorithms.
I implemented these algorithms out of personal interest.

More information on ENIAC algorythm square root may be found at:
https://michaeldipperstein.github.io/sqrt.html
http://www4.wittenberg.edu/academics/mathcomp/bjsdir/ENIACSquareRoot.htm

Successive approximation and bisection are popular techniques and widely
discussed.

FILES
-----
COPYING         - Rules for copying and distributing GPL software
COPYING.LESSER  - Rules for copying and distributing LGPL software
gettimeofday.c  - Windows code to emulate gettimeofday function.  The source for
                  this function comes from Postgres SQL (See file header).
Makefile        - Makefile for this project (assumes gcc compiler and GNU make)
README          - This file
sample.c        - Sample code demonstrating usage of the square root library
sqrt.h          - Header file for the square root library
sqrt.c          - Implementation of the square root library

BUILDING
--------
To build these files with GNU make and gcc, simply enter "make" from the
command line.

Note: The Makefile assumes the use of gcc in a Linux or Windows environment.
Other environments may require customization.

USAGE
-----
Usage:  sample <number of random squares>

The sample code will generate <number of random squares> squares and display
the square root computed by each algorithm in comparison with the value
computed by the sqrt() function in the C math library.

AUTHOR
------
Michael Dipperstein (mdipperstein@gmail.com)