Loading...
Searching...
No Matches
Go to the documentation of this file.
27#define R_D__0 (log_p ? ML_NEGINF : 0.)
28#define R_D__1 (log_p ? 0. : 1.)
29#define R_DT_0 (lower_tail ? R_D__0 : R_D__1)
30#define R_DT_1 (lower_tail ? R_D__1 : R_D__0)
33#define R_D_Lval(p) (lower_tail ? (p) : (0.5 - (p) + 0.5))
34#define R_D_Cval(p) (lower_tail ? (0.5 - (p) + 0.5) : (p))
36#define R_D_val(x) (log_p ? ::log(x) : (x))
37#define R_D_qIv(p) (log_p ? ::exp(p) : (p))
38#define R_D_exp(x) (log_p ? (x) : ::exp(x))
39#define R_D_log(p) (log_p ? (p) : ::log(p))
40#define R_D_Clog(p) (log_p ? ::log1p(-(p)) : (0.5 - (p) + 0.5))
43#define R_Log1_Exp(x) ((x) > -M_LN2 ? ::log(-::expm1(x)) : ::log1p(-::exp(x)))
46#define R_D_LExp(x) (log_p ? R_Log1_Exp(x) : ::log1p(-x))
48#define R_DT_val(x) (lower_tail ? R_D_val(x) : R_D_Clog(x))
49#define R_DT_Cval(x) (lower_tail ? R_D_Clog(x) : R_D_val(x))
52#define R_DT_qIv(p) (log_p ? (lower_tail ? ::exp(p) : - ::expm1(p)) \
56#define R_DT_CIv(p) (log_p ? (lower_tail ? -expm1(p) : ::exp(p)) \
59#define R_DT_exp(x) R_D_exp(R_D_Lval(x))
60#define R_DT_Cexp(x) R_D_exp(R_D_Cval(x))
62#define R_DT_log(p) (lower_tail? R_D_log(p) : R_D_LExp(p))
63#define R_DT_Clog(p) (lower_tail? R_D_LExp(p): R_D_log(p))
64#define R_DT_Log(p) (lower_tail? (p) : R_Log1_Exp(p))
68#define R_Q_P01_check(p) \
69 if ((log_p && p > 0) || \
70 (!log_p && (p < 0 || p > 1)) ) \
84#define R_Q_P01_boundaries(p, _LEFT_, _RIGHT_) \
89 return lower_tail ? _RIGHT_ : _LEFT_; \
91 return lower_tail ? _LEFT_ : _RIGHT_; \
97 return lower_tail ? _LEFT_ : _RIGHT_; \
99 return lower_tail ? _RIGHT_ : _LEFT_; \
102#define R_P_bounds_01(x, x_min, x_max) \
103 if(x <= x_min) return R_DT_0; \
104 if(x >= x_max) return R_DT_1
107#define R_P_bounds_Inf_01(x) \
109 if (x > 0) return R_DT_1; \
116#define R_D_fexp(f,x) (give_log ? -0.5*log(f)+(x) : exp(x)/sqrt(f))
117#define R_D_forceint(x) floor((x) + 0.5)
118#define R_D_nonint(x) (fabs((x) - floor((x)+0.5)) > 1e-7)
120#define R_D_negInonint(x) (x < 0. || R_D_nonint(x))
122#define R_D_nonint_check(x) \
123 if(R_D_nonint(x)) { \
124 MATHLIB_WARNING("non-integer x = %f", x); \