MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / pnorm_1

Function pnorm_1

inst/include/Rcpp/stats/norm.h:56–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56inline double pnorm_1(double x, double mu /*, double sigma [=1.]*/ ,
57 int lower_tail, int log_p) {
58 double p, cp;
59
60 /* Note: The structure of these checks has been carefully thought through.
61 * For example, if x == mu and sigma == 0, we get the correct answer 1.
62 */
63#ifdef IEEE_754
64 if (ISNAN(x) || ISNAN(mu))
65 return x + mu + 1.0;
66#endif
67 if (!R_FINITE(x) && mu == x) return ML_NAN; /* x-mu is NaN */
68 p = (x - mu);
69 if (!R_FINITE(p))
70 return (x < mu) ? R_DT_0 : R_DT_1;
71 x = p;
72
73 ::Rf_pnorm_both(x, &p, &cp, (lower_tail ? 0 : 1), log_p);
74
75 return(lower_tail ? p : cp);
76}
77
78inline double pnorm_0(double x /*, double mu [=0.] , double sigma [=1.]*/ , int lower_tail, int log_p) {
79 double p, cp;

Callers 1

plnorm_1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected