1. Computing

Discuss in my forum

Variations of Pi

By , About.com Guide

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;
?>

See More About
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. PHP Functions
  5. Variations of Pi

©2013 About.com. All rights reserved.