21 #ifndef MATHLIB_PRIVATE_H 22 #define MATHLIB_PRIVATE_H 29 #ifdef HAVE_LONG_DOUBLE 30 # define LDOUBLE long double 32 # define LDOUBLE double 36 # ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ 37 # define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 47 double Rf_d1mach(
int);
48 double Rf_gamma_cody(
double);
53 #include <R_ext/Print.h> 57 # define R_forceint(x) nearbyint() 59 # define R_forceint(x) round(x) 62 # define R_nonint(x) (fabs((x) - R_forceint(x)) > 1e-7*fmax2(1., fabs(x))) 64 #ifndef MATHLIB_STANDALONE 66 #include <R_ext/Error.h> 67 # define MATHLIB_ERROR(fmt,x) error(fmt,x); 68 # define MATHLIB_WARNING(fmt,x) warning(fmt,x) 69 # define MATHLIB_WARNING2(fmt,x,x2) warning(fmt,x,x2) 70 # define MATHLIB_WARNING3(fmt,x,x2,x3) warning(fmt,x,x2,x3) 71 # define MATHLIB_WARNING4(fmt,x,x2,x3,x4) warning(fmt,x,x2,x3,x4) 72 # define MATHLIB_WARNING5(fmt,x,x2,x3,x4,x5) warning(fmt,x,x2,x3,x4,x5) 74 #include <R_ext/Arith.h> 75 #define ML_POSINF R_PosInf 76 #define ML_NEGINF R_NegInf 80 void R_CheckUserInterrupt(
void);
86 #define calloc R_chk_calloc 90 #define free R_chk_free 94 #define _(String) gettext (String) 96 #define _(String) (String) 104 #define MATHLIB_ERROR(fmt,x) { printf(fmt,x); exit(1); } 105 #define MATHLIB_WARNING(fmt,x) printf(fmt,x) 106 #define MATHLIB_WARNING2(fmt,x,x2) printf(fmt,x,x2) 107 #define MATHLIB_WARNING3(fmt,x,x2,x3) printf(fmt,x,x2,x3) 108 #define MATHLIB_WARNING4(fmt,x,x2,x3,x4) printf(fmt,x,x2,x3,x4) 109 #define MATHLIB_WARNING5(fmt,x,x2,x3,x4,x5) printf(fmt,x,x2,x3,x4,x5) 111 #define ISNAN(x) (isnan(x)!=0) 114 #ifdef HAVE_WORKING_ISFINITE 116 # define R_FINITE(x) isfinite(x) 118 # define R_FINITE(x) R_finite(x) 121 int R_finite(
double);
123 #define ML_POSINF (1.0 / 0.0) 124 #define ML_NEGINF ((-1.0) / 0.0) 125 #define ML_NAN (0.0 / 0.0) 127 #define _(String) String 130 #define ML_VALID(x) (!ISNAN(x)) 140 #define ME_PRECISION 8 142 #define ME_UNDERFLOW 16 145 #define ML_ERR_return_NAN { ML_ERROR(ME_DOMAIN, ""); return ML_NAN; } 151 #define ML_ERROR(x, s) { \ 152 if(x > ME_DOMAIN) { \ 153 const char *msg = ""; \ 156 msg = _("argument out of domain in '%s'\n"); \ 159 msg = _("value out of range in '%s'\n"); \ 162 msg = _("convergence failed in '%s'\n"); \ 165 msg = _("full precision may not have been achieved in '%s'\n"); \ 168 msg = _("underflow occurred in '%s'\n"); \ 171 MATHLIB_WARNING(msg, s); \ 177 #define WILCOX_MAX 50 179 #ifdef HAVE_VISIBILITY_ATTRIBUTE 180 # define attribute_hidden __attribute__ ((visibility ("hidden"))) 182 # define attribute_hidden 189 #define chebyshev_eval Rf_chebyshev_eval 190 #define chebyshev_init Rf_chebyshev_init 191 #define gammalims Rf_gammalims 192 #define lfastchoose Rf_lfastchoose 193 #define lgammacor Rf_lgammacor 194 #define stirlerr Rf_stirlerr 195 #define pnchisq_raw Rf_pnchisq_raw 196 #define pgamma_raw Rf_pgamma_raw 197 #define pnbeta_raw Rf_pnbeta_raw 198 #define pnbeta2 Rf_pnbeta2 199 #define bratio Rf_bratio 203 int attribute_hidden chebyshev_init(
double*,
int,
double);
204 double attribute_hidden chebyshev_eval(
double,
const double *,
const int);
208 void attribute_hidden gammalims(
double*,
double*);
209 double attribute_hidden lgammacor(
double);
210 double attribute_hidden stirlerr(
double);
212 double attribute_hidden lfastchoose(
double,
double);
214 double attribute_hidden bd0(
double,
double);
216 double attribute_hidden pnchisq_raw(
double,
double,
double,
double,
double,
218 double attribute_hidden pgamma_raw(
double,
double,
int,
int);
219 double attribute_hidden pbeta_raw(
double,
double,
double,
int,
int);
220 double attribute_hidden qchisq_appr(
double,
double,
double,
int,
int,
double tol);
221 LDOUBLE attribute_hidden pnbeta_raw(
double,
double,
double,
double,
double);
222 double attribute_hidden pnbeta2(
double,
double,
double,
double,
double,
int,
int);