⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathfunc.h

📁 数值计算工具库,C语言编写的,可以直接调用.
💻 H
📖 第 1 页 / 共 5 页
字号:
class _bz_atanh : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_IEEEMATHFN_SCOPE(atanh)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "atanh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// atan2(P_numtype1, P_numtype2)    Inverse tangent
template<class P_numtype1, class P_numtype2>
class _bz_atan2 : 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_MATHFN_SCOPE(atan2)((double)x,(double)y); }

    template<class T1, class T2>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a, const T2& b)
    {
        str += "atan2(";
        a.prettyPrint(str,format);
        str += ",";
        b.prettyPrint(str,format);
        str += ")";
    }
};

// atan2(float, float)
template<>
class _bz_atan2<float, float > : public TwoOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype2;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
    { return BZ_MATHFN_SCOPE(atan2)((float)x,(float)y); }

    template<class T1, class T2>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a, const T2& b)
    {
        str += "atan2(";
        a.prettyPrint(str,format);
        str += ",";
        b.prettyPrint(str,format);
        str += ")";
    }
};

// atan2(long double, long double)
template<>
class _bz_atan2<long double, long double > : public TwoOperandApplicativeTemplatesBase {
public:
    typedef long double T_numtype1;
    typedef long double T_numtype2;
    typedef long double T_numtype;

    static inline T_numtype apply(T_numtype1 x, T_numtype2 y)
    { return BZ_MATHFN_SCOPE(atan2)((long double)x,(long double)y); }

    template<class T1, class T2>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a, const T2& b)
    {
        str += "atan2(";
        a.prettyPrint(str,format);
        str += ",";
        b.prettyPrint(str,format);
        str += ")";
    }
};

// _class(P_numtype1)    Classification of float-point value (FP_xxx)
#ifdef BZ_HAVE_SYSTEM_V_MATH
template<class P_numtype1>
class _bz__class : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef int T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_IEEEMATHFN_SCOPE(_class)(x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "_class(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cbrt(P_numtype1)    Cube root
#ifdef BZ_HAVE_IEEE_MATH
template<class P_numtype1>
class _bz_cbrt : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_IEEEMATHFN_SCOPE(cbrt)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cbrt(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// ceil(P_numtype1)    Ceiling
template<class P_numtype1>
class _bz_ceil : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(ceil)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "ceil(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// ceil(float)
template<>
class _bz_ceil<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(ceil)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "ceil(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// ceil(long double)
template<>
class _bz_ceil<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(ceil)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "ceil(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// conj(P_numtype1)
#ifdef BZ_HAVE_COMPLEX_MATH
template<class P_numtype1>
class _bz_conj : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef P_numtype1 T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_CMATHFN_SCOPE(conj)(x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "conj(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cos(P_numtype1)    Cosine
template<class P_numtype1>
class _bz_cos : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(cos)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cos(float)
template<>
class _bz_cos<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(cos)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cos(long double)
template<>
class _bz_cos<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(cos)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cos(complex<float> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cos<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(cos)((complex<float> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cos(complex<double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cos<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(cos)((complex<double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cos(complex<long double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cos<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(cos)((complex<long double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cos(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// copysign(P_numtype1, P_numtype2)
#ifdef BZ_HAVE_SYSTEM_V_MATH
template<class P_numtype1, class P_numtype2>
class _bz_copysign : 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(copysign)((double)x,(double)y); }

    template<class T1, class T2>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a, const T2& b)
    {
        str += "copysign(";
        a.prettyPrint(str,format);
        str += ",";
        b.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cosh(P_numtype1)    Hyperbolic cosine
template<class P_numtype1>
class _bz_cosh : public OneOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;
    typedef double T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(cosh)((double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cosh(float)
template<>
class _bz_cosh<float> : public OneOperandApplicativeTemplatesBase {
public:
    typedef float T_numtype1;
    typedef float T_numtype;

    static inline T_numtype apply(T_numtype1 x)
    { return BZ_MATHFN_SCOPE(cosh)((float)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cosh(long double)
template<>
class _bz_cosh<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(cosh)((long double)x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};

// cosh(complex<float> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cosh<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(cosh)((complex<float> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cosh(complex<double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cosh<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(cosh)((complex<double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// cosh(complex<long double> )
#ifdef BZ_HAVE_COMPLEX_MATH
template<>
class _bz_cosh<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(cosh)((complex<long double> )x); }

    template<class T1>
    static void prettyPrint(string& str, prettyPrintFormat& format,
        const T1& a)
    {
        str += "cosh(";
        a.prettyPrint(str,format);
        str += ")";
    }
};
#endif

// drem(P_numtype1, P_numtype2)    Remainder
#ifdef BZ_HAVE_SYSTEM_V_MATH
template<class P_numtype1, class P_numtype2>
class _bz_drem : public TwoOperandApplicativeTemplatesBase {
public:
    typedef P_numtype1 T_numtype1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -