1. Computing & Technology

Discuss in my forum

Variations of Pi

By , About.com Guide

See More About:
Often when you use PI it's not actually PI you want, its a variation of PI. Here are some of the popular variations built into PHP:

M_PI_2 = Half of PI ()
M_PI_4 = One Quarter PI ()
M_1_PI =One divided by PI ()
M_2_PI = Two divided by PI ()
M_SQRTPI = Square root of PI ()
M_2_SQRTPI = Two Divided by the square root of PI ()

Using these variations:

M_PI is a constant that will produce the same value as PI (). Here is an example of how to use M_PI and it's variations:

echo M_PI;
echo "
";
echo M_2_PI * 4;
?>

©2012 About.com. All rights reserved.

A part of The New York Times Company.