/*
###########################################################################
This function computes the double factorial value for a positive integer
argument using arbitrary-precision.
The double factorial of IntN is the product of every other positive integer
with the same parity as IntN in the range from 1 up to and including IntN.
The parity simply refers to whether an integer is an odd number or an even
number.
The double factorial values of 0 and -1 are equated to 1 by definition, but
double factorial values for integers that are less than -1 are not defined.
ERRORS:
Returns FALSE if (IntN) is non-numeric or (IntN < -1).
NO DEPENDENCIES
###########################################################################
*/
function BC_Double_Fact ($IntN='1')
{
$N = trim($IntN); if (!Is_Numeric($N) or $N < -1) {return FALSE;}
// Compute double factorial of (N).
$N = bcAdd($N, '0');
$j = ceil($N/2) - 1;
$P = '1'; for($i=0; $i <= $j; $i++) {$P = bcMul($P, $N - 2*$i);}
return $P;
} // End of BC_Double_Fact (...)