ApproximateFactorial function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Math

Package: Microsoft.Quantum.Standard

Returns an approximate factorial of a given number.

function ApproximateFactorial (n : Int) : Double

Description

Returns the factorial as Double, given an input of $n$ as a Double. The domain of inputs for this function is n < 170.

Input

n : Int

The number to take the approximate factorial of. Must not be negative.

Output : Double

The approximate factorial of n.

Remarks

For $n \ge 10$, this function uses the Ramanujan approximation with a relative error to the order of $1 / n^5$.

See Also