- Home
·
- Math/Dates
·
- Algorithm that calculates the Factorial of Numbers (N!) up to 170
Algorithm that calculates the Factorial of Numbers (N!) up to 170
Algorithm that calculates the Factorial of Numbers (N!) up to 170
Rate Algorithm that calculates the Factorial of Numbers (N!) up to 170
(2(2 Vote))
On Error GoTo ErrorHandler
'**********************************************************************************************************
'
'Purpose: Algorithm that calculates the Factorial of Numbers (N!) up to 170.
'
'Argument(s): N - long integer number less than 171.
'
'Source: http://www.paretoanalysts.com
'
'Author: Pareto Analysts
'
'Creation Date: December 1, 2001
'
'Description: Calculates the Factorial of a Number. N! can be computed as 'N*(N-1)*(N-2)...(N-(N-1))*2*1
' E.g. 5! = 5*4*3*2*1
'
'Return Value: The Factorial of the Number passed to it.
'
'Return Type: Double
'
'Limitation: The Largest Number that can be passed is 170 corresponding to '170!(7.25741561530799E+306)
'
'
'Warranty : No claim is made as to the accuracy or fitness of this algorithm. The use of this
' algorithm is at your own risk and choice and the author is not liable in anyway
' for its use or damages that may occur as a result of its use.
'
'Copyright: The use or distribution of this algorithm is free provided that it is
' used or distributed along with this header notice and this header notice
' has not been modified in any way. If this algorithm is used in a compiled form then
' the header notice must also be placed in a readme.txt file
'
'Inquiries: Inquiries about this algorithm, data mining, statistical analysis and data analysis
' can be directed to http://www.paretoanalysts.com
'
'*******************************************************************************
If N < 0 Then
Factorial = 0
ElseIf N = 0 Then
Factorial = 1
Else
Factorial = N * Factorial(N - 1)
End If
Exit_ErrorHandler:
Exit Function
ErrorHandler:
MsgBox Err.Number & " " & Err.Description, vbInformation, "www.paretoanalysts.com Factorial "
Resume Exit_ErrorHandler
End Function
Algorithm that calculates the Factorial of Numbers (N!) up to 170 Comments
No comments yet — be the first to post one!
Post a Comment