So, perhaps you are used to thinking in degrees, not radians.
How do you convert between the two when you use the above
functions? That's as easy as pi! If you have the angle in
degrees and one of side lengths, first multiple that angle by
pi / 180.0 (either
to get radians, and
then use that resulting theta in the appropriate
There are several engrossing exercises for computing pi, and several novel approaches. The most widely-known approach is to compute the value of the series 4 - 4/3 + 4/5 - 4/7 ... (which takes a very large number of terms to get close to Chuck Moore's find (see below)). Another is to use the Fibonacci numbers (see this article on computing pi using arc-tangents) which become usable in about ten terms.
The approximation of pi for double-precision floating-point arithmetic.
The value here is 3.14159265358979323846. Chuck Moore, the inventor of the programming language Forth, chose instead to use 355 / 113 as pi (which is accurate to 3e-7), as computers at the time processed floating point operations too slowly for use in real-time applications.
The approximation of pi for single-precision floating-point arithmetic.
This pi is a truncated value of