CFLib.org – Common Function Library Project

CND(x)

Last updated March 10, 2003

author

Alex

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Computes cumulative normal distribution function.

Return Values:
Returns a numeric value.

Example:

<cfoutput>
CND(3) = #CND(3)#
</cfoutput>

Parameters:

Name Description Required
x value for which you want to compute the cumulative normal distribution Yes

Full UDF Source:

/**
 * Cumulative Normal Distribution
 * 
 * @param x      value for which you want to compute the cumulative normal distribution (Required)
 * @return Returns a numeric value. 
 * @author Alex (axs@arbornet.org) 
 * @version 1, March 10, 2003 
 */
function CND (x) {
    // The cumulative normal distribution function
    var Pi = 3.141592653589793238;
    var a1 = 0.31938153;
    var a2 = -0.356563782;
    var a3 = 1.781477937;
    var a4 = -1.821255978;
    var a5 = 1.330274429;
    var L = abs(x);
    var k = 1 / ( 1 + 0.2316419 * L);
    var p = 1 - 1 /  ((2 * Pi)^0.5) * exp( -(L^2) / 2 ) * (a1 * k + a2 * (k^2) + a3 * (k^3) + a4 * (k^4) + a5 * (k^5) );

    if (x gte 0)
        return p;
    else
        return 1-p;

}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson