CND(x)
Last updated March 10, 2003
Version: 1 | Requires: ColdFusion 5 | Library: MathLib
Description:
Computes cumulative normal distribution function.
Return Values:
Returns a numeric value.
Example:
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:
<cfscript>
/**
* 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;
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)