It works perfectly on my non-joomla site: http://ncfoothills.net/scripts/estPi.php
But not on my Joomla site: http://www.ncfoothills.net/design/index.php/estimate-pi
The code is posted on both pages in an image. I'll post the math part below:
Code: Select all
function factorial($number)
{
if ($number == 0) return 1;
return $number * factorial($number - 1);
}
/********/
$factor = 2 * sqrt(2) / 9801;
$k = 0;
$term = 0;
$total = 0;
$count = 0;
do
{
$numor = factorial(4 * $k) * (1103 + 26390 * $k);
$denom = pow(factorial($k), 4) * pow(396, (4 * $k));
$term = $factor * $numor / $denom;
$total += $term;
$count++;
$k++;
}while($term > 1e-25);
I'm thinking it is a Joomla thing - any ideas?