3.5.2.1.35 FactDouble

Description

This function is used to calculate the double factorial of a non-negative integer n, denoted by:

n!! = 
\begin{cases} 
n*(n-2)...5*3*1, & \mbox{if }n \mbox{ is odd} \\
n*(n-2)...6*4*2, & \mbox{if }n \mbox{ is even} \\
1,  & n=0
\end{cases}

Please note that, to avoid overflow, the biggest integer can be specified is 299, if bigger than 299, this function will return missing value directly.

Syntax

double FactDouble(int n)

Parameters

n

The non-negative number for calculating double factorial.

Return

Return the double factorial of the specified number.

Example

factdouble(5) = ;  // 5*3*1=15
factdouble(6) = ;  // 6*4*2=48
factdouble(0) = ;  // 1
factdouble(1) = ;  // 1

See Also

Fact