Click or drag to resize

Fact Function

Calculate the factorial of a number.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.6
Syntax
 FUNCTION Fact(
	wValue AS DWORD
) AS FLOAT
Request Example View Source

Parameters

wValue
Type: UInt32
A positive number.

Return Value

Type: Float
Remarks
The factorial of an integer n is computed as follows:
X#
1Factorial(n)=n*(n-1)*(n-2) ... 3*2*1
The factorial of 0 is defined to be 1.
Examples
This example uses Fact() to compute the factorial of 5, then it verifies the result:
X#
1? Fact(5)                    // 120
2// Verify
3? 5*4*3*2*1                    // 120
See Also