Math functions are now declared as templates.
This commit is contained in:
parent
feba5f04f1
commit
ac244d92ee
|
@ -441,21 +441,45 @@ void QmuParser::InitFun()
|
||||||
DefineFun(QStringLiteral("degTorad"), DegreeToRadian);
|
DefineFun(QStringLiteral("degTorad"), DegreeToRadian);
|
||||||
DefineFun(QStringLiteral("radTodeg"), RadianToDegree);
|
DefineFun(QStringLiteral("radTodeg"), RadianToDegree);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
#define QSIN_FUN qSin<qreal>
|
||||||
|
#define QCOS_FUN qCos<qreal>
|
||||||
|
#define QTAN_FUN qTan<qreal>
|
||||||
|
#define QASIN_FUN qAsin<qreal>
|
||||||
|
#define QACOS_FUN qAcos<qreal>
|
||||||
|
#define QATAN_FUN qAtan<qreal>
|
||||||
|
#define QATAN2_FUN qAtan2<qreal, qreal>
|
||||||
|
#define QLN_FUN qLn<qreal>
|
||||||
|
#define QEXP_FUN qExp<qreal>
|
||||||
|
#define QSQRT_FUN qSqrt<qreal>
|
||||||
|
#else
|
||||||
|
#define QSIN_FUN qSin
|
||||||
|
#define QCOS_FUN qCos
|
||||||
|
#define QTAN_FUN qTan
|
||||||
|
#define QASIN_FUN qAsin
|
||||||
|
#define QACOS_FUN qAcos
|
||||||
|
#define QATAN_FUN qAtan
|
||||||
|
#define QATAN2_FUN qAtan2
|
||||||
|
#define QLN_FUN qLn
|
||||||
|
#define QEXP_FUN qExp
|
||||||
|
#define QSQRT_FUN qSqrt
|
||||||
|
#endif
|
||||||
|
|
||||||
// trigonometric functions
|
// trigonometric functions
|
||||||
DefineFun(QStringLiteral("sin"), qSin);
|
DefineFun(QStringLiteral("sin"), QSIN_FUN);
|
||||||
DefineFun(QStringLiteral("cos"), qCos);
|
DefineFun(QStringLiteral("cos"), QCOS_FUN);
|
||||||
DefineFun(QStringLiteral("tan"), qTan);
|
DefineFun(QStringLiteral("tan"), QTAN_FUN);
|
||||||
DefineFun(QStringLiteral("sinD"), SinD);
|
DefineFun(QStringLiteral("sinD"), SinD);
|
||||||
DefineFun(QStringLiteral("cosD"), CosD);
|
DefineFun(QStringLiteral("cosD"), CosD);
|
||||||
DefineFun(QStringLiteral("tanD"), TanD);
|
DefineFun(QStringLiteral("tanD"), TanD);
|
||||||
// arcus functions
|
// arcus functions
|
||||||
DefineFun(QStringLiteral("asin"), qAsin);
|
DefineFun(QStringLiteral("asin"), QASIN_FUN);
|
||||||
DefineFun(QStringLiteral("acos"), qAcos);
|
DefineFun(QStringLiteral("acos"), QACOS_FUN);
|
||||||
DefineFun(QStringLiteral("atan"), qAtan);
|
DefineFun(QStringLiteral("atan"), QATAN_FUN);
|
||||||
DefineFun(QStringLiteral("atan2"), qAtan2);
|
DefineFun(QStringLiteral("atan2"), QATAN2_FUN);
|
||||||
DefineFun(QStringLiteral("asinD"), ASinD);
|
DefineFun(QStringLiteral("asinD"), ASinD);
|
||||||
DefineFun(QStringLiteral("acosD"), ACosD);
|
DefineFun(QStringLiteral("acosD"), ACosD);
|
||||||
DefineFun(QStringLiteral("atanD"), ATanD);
|
DefineFun(QStringLiteral("atanD"), ATanD);
|
||||||
// hyperbolic functions
|
// hyperbolic functions
|
||||||
DefineFun(QStringLiteral("sinh"), Sinh);
|
DefineFun(QStringLiteral("sinh"), Sinh);
|
||||||
DefineFun(QStringLiteral("cosh"), Cosh);
|
DefineFun(QStringLiteral("cosh"), Cosh);
|
||||||
|
@ -468,10 +492,10 @@ void QmuParser::InitFun()
|
||||||
DefineFun(QStringLiteral("log2"), Log2);
|
DefineFun(QStringLiteral("log2"), Log2);
|
||||||
DefineFun(QStringLiteral("log10"), Log10);
|
DefineFun(QStringLiteral("log10"), Log10);
|
||||||
DefineFun(QStringLiteral("log"), Log10);
|
DefineFun(QStringLiteral("log"), Log10);
|
||||||
DefineFun(QStringLiteral("ln"), qLn);
|
DefineFun(QStringLiteral("ln"), QLN_FUN);
|
||||||
// misc
|
// misc
|
||||||
DefineFun(QStringLiteral("exp"), qExp);
|
DefineFun(QStringLiteral("exp"), QEXP_FUN);
|
||||||
DefineFun(QStringLiteral("sqrt"), qSqrt);
|
DefineFun(QStringLiteral("sqrt"), QSQRT_FUN);
|
||||||
DefineFun(QStringLiteral("sign"), Sign);
|
DefineFun(QStringLiteral("sign"), Sign);
|
||||||
DefineFun(QStringLiteral("rint"), Rint);
|
DefineFun(QStringLiteral("rint"), Rint);
|
||||||
DefineFun(QStringLiteral("r2cm"), R2CM);
|
DefineFun(QStringLiteral("r2cm"), R2CM);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user