Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
cdf_22.c
Go to the documentation of this file.00001 #include "cdflib.h"
00002 void cdfnor(int *which,double *p,double *q,double *x,double *mean,
00003 double *sd,int *status,double *bound)
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 {
00097 static int K1 = 1;
00098 static double z,pq;
00099
00100
00101
00102
00103
00104
00105
00106 *status = 0;
00107 if(!(*which < 1 || *which > 4)) goto S30;
00108 if(!(*which < 1)) goto S10;
00109 *bound = 1.0e0;
00110 goto S20;
00111 S10:
00112 *bound = 4.0e0;
00113 S20:
00114 *status = -1;
00115 return;
00116 S30:
00117 if(*which == 1) goto S70;
00118
00119
00120
00121 if(!(*p <= 0.0e0 || *p > 1.0e0)) goto S60;
00122 if(!(*p <= 0.0e0)) goto S40;
00123 *bound = 0.0e0;
00124 goto S50;
00125 S40:
00126 *bound = 1.0e0;
00127 S50:
00128 *status = -2;
00129 return;
00130 S70:
00131 S60:
00132 if(*which == 1) goto S110;
00133
00134
00135
00136 if(!(*q <= 0.0e0 || *q > 1.0e0)) goto S100;
00137 if(!(*q <= 0.0e0)) goto S80;
00138 *bound = 0.0e0;
00139 goto S90;
00140 S80:
00141 *bound = 1.0e0;
00142 S90:
00143 *status = -3;
00144 return;
00145 S110:
00146 S100:
00147 if(*which == 1) goto S150;
00148
00149
00150
00151 pq = *p+*q;
00152 if(!(fabs(pq-0.5e0-0.5e0) > 3.0e0*spmpar(&K1))) goto S140;
00153 if(!(pq < 0.0e0)) goto S120;
00154 *bound = 0.0e0;
00155 goto S130;
00156 S120:
00157 *bound = 1.0e0;
00158 S130:
00159 *status = 3;
00160 return;
00161 S150:
00162 S140:
00163 if(*which == 4) goto S170;
00164
00165
00166
00167 if(!(*sd <= 0.0e0)) goto S160;
00168 *bound = 0.0e0;
00169 *status = -6;
00170 return;
00171 S170:
00172 S160:
00173
00174
00175
00176 if(1 == *which) {
00177
00178
00179
00180 z = (*x-*mean)/ *sd;
00181 cumnor(&z,p,q);
00182 }
00183 else if(2 == *which) {
00184
00185
00186
00187 z = dinvnr(p,q);
00188 *x = *sd*z+*mean;
00189 }
00190 else if(3 == *which) {
00191
00192
00193
00194 z = dinvnr(p,q);
00195 *mean = *x-*sd*z;
00196 }
00197 else if(4 == *which) {
00198
00199
00200
00201 z = dinvnr(p,q);
00202 *sd = (*x-*mean)/z;
00203 }
00204 return;
00205 }