1 #ifndef TINY_AD_GAMMA_H 2 #define TINY_AD_GAMMA_H 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) 68 #define M_LOG10_2 0.301029995663981195213738894724 71 #define M_LN_SQRT_PI 0.572364942924700087071713675677 75 #define M_LN_SQRT_2PI 0.918938533204672741780329736406 79 #define M_SQRT_PI 1.772453850905516027298167483341 82 #ifndef M_LN_SQRT_PId2 83 #define M_LN_SQRT_PId2 0.225791352644727432363097614947 88 #ifndef MATHLIB_PRIVATE_H 89 #define MATHLIB_PRIVATE_H 91 #ifdef HAVE_VISIBILITY_ATTRIBUTE 92 # define attribute_hidden __attribute__ ((visibility ("hidden"))) 94 # define attribute_hidden 96 #define ML_ERR_return_NAN { ML_ERROR(ME_DOMAIN, ""); return ML_NAN; } 100 template<
class Float> Float lgammafn(Float x);
102 template <
class Float> Float sinpi(Float x) {
return sin(x * M_PI); }
104 #include "chebyshev.cpp" 105 #include "lgammacor.cpp" 109 #include "stirlerr.cpp" 121 #include "lgamma.cpp" 124 #include "gamma_cody.cpp"