Login     Register

        Contact Us     Search

XLeratorDB/statistics Documentation

SQL Server natural logarIthm of the factorial function


 
Updated: 9 August 2010

Use FACTLN to calculate the natural logarithm of a factorial. It can be useful to have the natural logarithm available because the limits of the float data type in SQL Server limit the maximum value of a factorial to 171! The natural logarithm can be substituted in many calculations; just remember to use the EXP() function on the final result.
 
Syntax
SELECT [wctStatistics].[wct].[FACTLN] (
   <@Number, float,>)
Arguments
@Number
is the value to be evaluated by the function. @Number is an expression of type float or of a type that can be implicitly converted to float
Return Types
float
Remarks
·         If @Number < 0, FACTLN returns an error.
·         @Number is truncated to zero decimal places.
Examples

SELECT
wct.FACTLN(5)
 

This produces the following result
----------------------
4.78749174278205
 
(1 row(s) affected)
 


SELECT
EXP(wct.FACTLN(200) - wct.FACTLN(175))
 

This produces the following result

----------------------
7.01372425899837E+56
 
(1 row(s) affected)


Copyright 2008-2017 Westclintech LLC         Privacy Policy        Terms of Service