22 #ifndef Rcpp__stats__norm_h
23 #define Rcpp__stats__norm_h
30 if (ISNAN(x) || ISNAN(mu))
33 if (!R_FINITE(x) && mu == x)
return ML_NAN;
36 if (!R_FINITE(x))
return R_D__0;
38 -(M_LN_SQRT_2PI + 0.5 * x * x) :
39 M_1_SQRT_2PI *
::exp(-0.5 * x * x));
49 if (!R_FINITE(x))
return R_D__0;
51 -(M_LN_SQRT_2PI + 0.5 * x * x) :
52 M_1_SQRT_2PI * ::
exp(-0.5 * x * x));
56 inline double pnorm_1(
double x,
double mu ,
57 int lower_tail,
int log_p) {
64 if (ISNAN(x) || ISNAN(mu))
67 if (!R_FINITE(x) && mu == x)
return ML_NAN;
73 ::Rf_pnorm_both(x, &p, &cp, (lower_tail ? 0 : 1), log_p);
75 return(lower_tail ? p : cp);
78 inline double pnorm_0(
double x ,
int lower_tail,
int log_p) {
93 ::Rf_pnorm_both(x, &p, &cp, (lower_tail ? 0 : 1), log_p);
95 return(lower_tail ? p : cp);
98 inline double qnorm_1(
double p,
double mu ,
99 int lower_tail,
int log_p){
100 return ::Rf_qnorm5(p, mu, 1.0, lower_tail, log_p);
104 int lower_tail,
int log_p){
105 return ::Rf_qnorm5(p, 0.0, 1.0, lower_tail, log_p);
113 RCPP_DPQ_2(norm, ::Rf_dnorm4, ::Rf_pnorm5, ::Rf_qnorm5)
#define RCPP_DPQ_2(__NAME__, __D__, __P__, __Q__)
#define RCPP_DPQ_1(__NAME__, __D__, __P__, __Q__)
#define RCPP_DPQ_0(__NAME__, __D__, __P__, __Q__)
void exp(InputIterator begin, InputIterator end, OutputIterator out)
double pnorm_0(double x, int lower_tail, int log_p)
double pnorm_1(double x, double mu, int lower_tail, int log_p)
double dnorm_0(double x, int give_log)
double qnorm_1(double p, double mu, int lower_tail, int log_p)
double qnorm_0(double p, int lower_tail, int log_p)
double dnorm_1(double x, double mu, int give_log)