18 #define R_PosInf INFINITY 19 #define R_NegInf -INFINITY 24 #define R_FINITE(x) R_finite(x) 30 template<
class T>
int R_finite(T x) {
return std::isfinite(asDouble(x)); }
31 template<
class T>
int isnan(T x) {
return std::isnan(asDouble(x)); }
36 #undef MATHLIB_WARNING 37 #undef MATHLIB_WARNING2 38 #undef MATHLIB_WARNING3 39 #undef MATHLIB_WARNING4 40 #undef MATHLIB_WARNING5 46 # define ML_ERROR(x, s) 47 # define MATHLIB_ERROR(fmt,x) 48 # define MATHLIB_WARNING(fmt,x) 49 # define MATHLIB_WARNING2(fmt,x,x2) 50 # define MATHLIB_WARNING3(fmt,x,x2,x3) 51 # define MATHLIB_WARNING4(fmt,x,x2,x3,x4) 52 # define MATHLIB_WARNING5(fmt,x,x2,x3,x4,x5) 53 #define ML_POSINF R_PosInf 54 #define ML_NEGINF R_NegInf 56 #define M_SQRT_2dPI 0.797884560802865355879892119869 57 #define ISNAN(x) (isnan(x)!=0) 64 #define M_LOG10_2 0.301029995663981195213738894724 67 #define M_LN_SQRT_PI 0.572364942924700087071713675677 71 #define M_LN_SQRT_2PI 0.918938533204672741780329736406 75 #define M_SQRT_PI 1.772453850905516027298167483341 80 T fmax2(T x, T y) {
return (x < y) ? y : x;}
83 return fmax2 (logx, logy) + log1p (exp (-fabs (logx - logy)));
87 #ifndef MATHLIB_PRIVATE_H 88 #define MATHLIB_PRIVATE_H 90 #ifdef HAVE_VISIBILITY_ATTRIBUTE 91 # define attribute_hidden __attribute__ ((visibility ("hidden"))) 93 # define attribute_hidden 95 #define ML_ERR_return_NAN { ML_ERROR(ME_DOMAIN, ""); return ML_NAN; } 99 #include "toms708.cpp"
Type logspace_add(Type logx, Type logy)
Addition in log-space.