📄 mathfunc.h
字号:
static inline T_numtype apply(T_numtype1 x, T_numtype2 y) { return BZ_IEEEMATHFN_SCOPE(hypot)((double)x,(double)y); } template<typename T1, typename T2> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a, const T2& b) { str += "hypot("; a.prettyPrint(str,format); str += ","; b.prettyPrint(str,format); str += ")"; }};#endif// ilogb(P_numtype1) Integer unbiased exponent#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_ilogb : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef int T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(ilogb)(x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "ilogb("; a.prettyPrint(str,format); str += ")"; }};#endif// blitz_isnan(P_numtype1) Nonzero if NaNS or NaNQ#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_blitz_isnan : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef int T_numtype; static inline T_numtype apply(T_numtype1 x) {#ifdef BZ_ISNAN_IN_NAMESPACE_STD return BZ_STD_SCOPE(isnan)(x);#else return BZ_IEEEMATHFN_SCOPE(isnan)(x);#endif } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "blitz_isnan("; a.prettyPrint(str,format); str += ")"; }};#endif// itrunc(P_numtype1) Truncate and convert to integer#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1>class _bz_itrunc : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef int T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(itrunc)(x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "itrunc("; a.prettyPrint(str,format); str += ")"; }};#endif// j0(P_numtype1) Bessel function first kind, order 0#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_j0 : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(j0)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "j0("; a.prettyPrint(str,format); str += ")"; }};#endif// j1(P_numtype1) Bessel function first kind, order 1#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_j1 : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(j1)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "j1("; a.prettyPrint(str,format); str += ")"; }};#endif// lgamma(P_numtype1) Log absolute gamma#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_lgamma : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(lgamma)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "lgamma("; a.prettyPrint(str,format); str += ")"; }};#endif// log(P_numtype1) Natural logarithmtemplate<typename P_numtype1>class _bz_log : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};// log(float)template<>class _bz_log<float> : public OneOperandApplicativeTemplatesBase {public: typedef float T_numtype1; typedef float T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log)((float)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};// log(long double)template<>class _bz_log<long double> : public OneOperandApplicativeTemplatesBase {public: typedef long double T_numtype1; typedef long double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log)((long double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};// log(complex<float> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_log<complex<float> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<float> T_numtype1; typedef complex<float> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log)((complex<float> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};#endif// log(complex<double> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_log<complex<double> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<double> T_numtype1; typedef complex<double> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log)((complex<double> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};#endif#ifndef __PGI// log(complex<long double> )#ifdef BZ_HAVE_COMPLEX_MATH1template<>class _bz_log<complex<long double> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<long double> T_numtype1; typedef complex<long double> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log)((complex<long double> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log("; a.prettyPrint(str,format); str += ")"; }};#endif#endif// logb(P_numtype1) Unbiased exponent (IEEE)#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_logb : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(logb)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "logb("; a.prettyPrint(str,format); str += ")"; }};#endif// log1p(P_numtype1) Compute log(1 + x)#ifdef BZ_HAVE_IEEE_MATHtemplate<typename P_numtype1>class _bz_log1p : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(log1p)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log1p("; a.prettyPrint(str,format); str += ")"; }};#endif// log10(P_numtype1) Logarithm base 10template<typename P_numtype1>class _bz_log10 : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log10)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};// log10(float)template<>class _bz_log10<float> : public OneOperandApplicativeTemplatesBase {public: typedef float T_numtype1; typedef float T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log10)((float)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};// log10(long double)template<>class _bz_log10<long double> : public OneOperandApplicativeTemplatesBase {public: typedef long double T_numtype1; typedef long double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_MATHFN_SCOPE(log10)((long double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};// log10(complex<float> )#ifdef BZ_HAVE_COMPLEX_MATH2template<>class _bz_log10<complex<float> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<float> T_numtype1; typedef complex<float> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log10)((complex<float> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};#endif// log10(complex<double> )#ifdef BZ_HAVE_COMPLEX_MATH2template<>class _bz_log10<complex<double> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<double> T_numtype1; typedef complex<double> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log10)((complex<double> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};#endif// log10(complex<long double> )#ifdef BZ_HAVE_COMPLEX_MATH2template<>class _bz_log10<complex<long double> > : public OneOperandApplicativeTemplatesBase {public: typedef complex<long double> T_numtype1; typedef complex<long double> T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_CMATHFN_SCOPE(log10)((complex<long double> )x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "log10("; a.prettyPrint(str,format); str += ")"; }};#endif// nearest(P_numtype1) Nearest floating point integer#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1>class _bz_nearest : public OneOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x) { return BZ_IEEEMATHFN_SCOPE(nearest)((double)x); } template<typename T1> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a) { str += "nearest("; a.prettyPrint(str,format); str += ")"; }};#endif// nextafter(P_numtype1, P_numtype2) Next representable number after x towards y#ifdef BZ_HAVE_SYSTEM_V_MATHtemplate<typename P_numtype1, typename P_numtype2>class _bz_nextafter : public TwoOperandApplicativeTemplatesBase {public: typedef P_numtype1 T_numtype1; typedef P_numtype2 T_numtype2; typedef double T_numtype; static inline T_numtype apply(T_numtype1 x, T_numtype2 y) { return BZ_IEEEMATHFN_SCOPE(nextafter)((double)x,(double)y); } template<typename T1, typename T2> static void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat& format, const T1& a, const T2& b) { str += "nextafter("; a.prettyPrint(str,format); str += ","; b.prettyPrint(str,format); str += ")"; }};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -