Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
cdf_39.c File Reference
#include "cdflib.h"
Go to the source code of this file.
|
Defines |
#define | maxit 100 |
#define | eps (1.0e-13) |
#define | r2pi 0.3989422804014326e0 |
#define | nhalf (-0.5e0) |
#define | dennor(x) (r2pi*exp(nhalf*(x)*(x))) |
Functions |
double | dinvnr (double *p, double *q) |
Define Documentation
#define dennor |
( |
x |
|
) |
(r2pi*exp(nhalf*(x)*(x)))
|
|
#define r2pi 0.3989422804014326e0
|
|
Function Documentation
double dinvnr |
( |
double * |
p, |
|
|
double * |
q |
|
) |
|
|
|
Definition at line 2 of file cdf_39.c.
References cumnor(), dinvnr(), i, p, q, and stvaln().
Referenced by cdfnor(), dinvnr(), and dt1().
00042 {
00043 #define maxit 100
00044 #define eps (1.0e-13)
00045 #define r2pi 0.3989422804014326e0
00046 #define nhalf (-0.5e0)
00047 #define dennor(x) (r2pi*exp(nhalf*(x)*(x)))
00048 static double dinvnr,strtx,xcur,cum,ccum,pp,dx;
00049 static int i;
00050 static unsigned long qporq;
00051
00052
00053
00054
00055
00056
00057
00058 qporq = *p <= *q;
00059 if(!qporq) goto S10;
00060 pp = *p;
00061 goto S20;
00062 S10:
00063 pp = *q;
00064 S20:
00065
00066
00067
00068 strtx = stvaln(&pp);
00069 xcur = strtx;
00070
00071
00072
00073 for(i=1; i<=maxit; i++) {
00074 cumnor(&xcur,&cum,&ccum);
00075 dx = (cum-pp)/dennor(xcur);
00076 xcur -= dx;
00077 if(fabs(dx/xcur) < eps) goto S40;
00078 }
00079 dinvnr = strtx;
00080
00081
00082
00083 if(!qporq) dinvnr = -dinvnr;
00084 return dinvnr;
00085 S40:
00086
00087
00088
00089 dinvnr = xcur;
00090 if(!qporq) dinvnr = -dinvnr;
00091 return dinvnr;
00092 #undef maxit
00093 #undef eps
00094 #undef r2pi
00095 #undef nhalf
00096 #undef dennor
00097 }
|