Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
cdf_17.c
Go to the documentation of this file.00001 #include "cdflib.h"
00002 void cdfchn(int *which,double *p,double *q,double *x,double *df,
00003 double *pnonc,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 #define tent4 1.0e4
00093 #define tol (1.0e-8)
00094 #define atol (1.0e-50)
00095 #define zero (1.0e-300)
00096 #define one (1.0e0-1.0e-16)
00097 #define inf 1.0e300
00098 static double K1 = 0.0e0;
00099 static double K3 = 0.5e0;
00100 static double K4 = 5.0e0;
00101 static double fx,cum,ccum;
00102 static unsigned long qhi,qleft;
00103 static double T2,T5,T6,T7,T8,T9,T10,T11,T12,T13;
00104
00105
00106
00107
00108
00109
00110
00111 if(!(*which < 1 || *which > 4)) goto S30;
00112 if(!(*which < 1)) goto S10;
00113 *bound = 1.0e0;
00114 goto S20;
00115 S10:
00116 *bound = 4.0e0;
00117 S20:
00118 *status = -1;
00119 return;
00120 S30:
00121 if(*which == 1) goto S70;
00122
00123
00124
00125 if(!(*p < 0.0e0 || *p > one)) goto S60;
00126 if(!(*p < 0.0e0)) goto S40;
00127 *bound = 0.0e0;
00128 goto S50;
00129 S40:
00130 *bound = one;
00131 S50:
00132 *status = -2;
00133 return;
00134 S70:
00135 S60:
00136 if(*which == 2) goto S90;
00137
00138
00139
00140 if(!(*x < 0.0e0)) goto S80;
00141 *bound = 0.0e0;
00142 *status = -4;
00143 return;
00144 S90:
00145 S80:
00146 if(*which == 3) goto S110;
00147
00148
00149
00150 if(!(*df <= 0.0e0)) goto S100;
00151 *bound = 0.0e0;
00152 *status = -5;
00153 return;
00154 S110:
00155 S100:
00156 if(*which == 4) goto S130;
00157
00158
00159
00160 if(!(*pnonc < 0.0e0)) goto S120;
00161 *bound = 0.0e0;
00162 *status = -6;
00163 return;
00164 S130:
00165 S120:
00166
00167
00168
00169 if(1 == *which) {
00170
00171
00172
00173 cumchn(x,df,pnonc,p,q);
00174 *status = 0;
00175 }
00176 else if(2 == *which) {
00177
00178
00179
00180 *x = 5.0e0;
00181 T2 = inf;
00182 T5 = atol;
00183 T6 = tol;
00184 dstinv(&K1,&T2,&K3,&K3,&K4,&T5,&T6);
00185 *status = 0;
00186 dinvr(status,x,&fx,&qleft,&qhi);
00187 S140:
00188 if(!(*status == 1)) goto S150;
00189 cumchn(x,df,pnonc,&cum,&ccum);
00190 fx = cum-*p;
00191 dinvr(status,x,&fx,&qleft,&qhi);
00192 goto S140;
00193 S150:
00194 if(!(*status == -1)) goto S180;
00195 if(!qleft) goto S160;
00196 *status = 1;
00197 *bound = 0.0e0;
00198 goto S170;
00199 S160:
00200 *status = 2;
00201 *bound = inf;
00202 S180:
00203 S170:
00204 ;
00205 }
00206 else if(3 == *which) {
00207
00208
00209
00210 *df = 5.0e0;
00211 T7 = zero;
00212 T8 = inf;
00213 T9 = atol;
00214 T10 = tol;
00215 dstinv(&T7,&T8,&K3,&K3,&K4,&T9,&T10);
00216 *status = 0;
00217 dinvr(status,df,&fx,&qleft,&qhi);
00218 S190:
00219 if(!(*status == 1)) goto S200;
00220 cumchn(x,df,pnonc,&cum,&ccum);
00221 fx = cum-*p;
00222 dinvr(status,df,&fx,&qleft,&qhi);
00223 goto S190;
00224 S200:
00225 if(!(*status == -1)) goto S230;
00226 if(!qleft) goto S210;
00227 *status = 1;
00228 *bound = zero;
00229 goto S220;
00230 S210:
00231 *status = 2;
00232 *bound = inf;
00233 S230:
00234 S220:
00235 ;
00236 }
00237 else if(4 == *which) {
00238
00239
00240
00241 *pnonc = 5.0e0;
00242 T11 = tent4;
00243 T12 = atol;
00244 T13 = tol;
00245 dstinv(&K1,&T11,&K3,&K3,&K4,&T12,&T13);
00246 *status = 0;
00247 dinvr(status,pnonc,&fx,&qleft,&qhi);
00248 S240:
00249 if(!(*status == 1)) goto S250;
00250 cumchn(x,df,pnonc,&cum,&ccum);
00251 fx = cum-*p;
00252 dinvr(status,pnonc,&fx,&qleft,&qhi);
00253 goto S240;
00254 S250:
00255 if(!(*status == -1)) goto S280;
00256 if(!qleft) goto S260;
00257 *status = 1;
00258 *bound = zero;
00259 goto S270;
00260 S260:
00261 *status = 2;
00262 *bound = tent4;
00263 S270:
00264 ;
00265 }
00266 S280:
00267 return;
00268 #undef tent4
00269 #undef tol
00270 #undef atol
00271 #undef zero
00272 #undef one
00273 #undef inf
00274 }