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("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
|
||||
DefineFun(QStringLiteral("sin"), qSin);
|
||||
DefineFun(QStringLiteral("cos"), qCos);
|
||||
DefineFun(QStringLiteral("tan"), qTan);
|
||||
DefineFun(QStringLiteral("sinD"), SinD);
|
||||
DefineFun(QStringLiteral("cosD"), CosD);
|
||||
DefineFun(QStringLiteral("tanD"), TanD);
|
||||
DefineFun(QStringLiteral("sin"), QSIN_FUN);
|
||||
DefineFun(QStringLiteral("cos"), QCOS_FUN);
|
||||
DefineFun(QStringLiteral("tan"), QTAN_FUN);
|
||||
DefineFun(QStringLiteral("sinD"), SinD);
|
||||
DefineFun(QStringLiteral("cosD"), CosD);
|
||||
DefineFun(QStringLiteral("tanD"), TanD);
|
||||
// arcus functions
|
||||
DefineFun(QStringLiteral("asin"), qAsin);
|
||||
DefineFun(QStringLiteral("acos"), qAcos);
|
||||
DefineFun(QStringLiteral("atan"), qAtan);
|
||||
DefineFun(QStringLiteral("atan2"), qAtan2);
|
||||
DefineFun(QStringLiteral("asinD"), ASinD);
|
||||
DefineFun(QStringLiteral("acosD"), ACosD);
|
||||
DefineFun(QStringLiteral("atanD"), ATanD);
|
||||
DefineFun(QStringLiteral("asin"), QASIN_FUN);
|
||||
DefineFun(QStringLiteral("acos"), QACOS_FUN);
|
||||
DefineFun(QStringLiteral("atan"), QATAN_FUN);
|
||||
DefineFun(QStringLiteral("atan2"), QATAN2_FUN);
|
||||
DefineFun(QStringLiteral("asinD"), ASinD);
|
||||
DefineFun(QStringLiteral("acosD"), ACosD);
|
||||
DefineFun(QStringLiteral("atanD"), ATanD);
|
||||
// hyperbolic functions
|
||||
DefineFun(QStringLiteral("sinh"), Sinh);
|
||||
DefineFun(QStringLiteral("cosh"), Cosh);
|
||||
|
@ -468,10 +492,10 @@ void QmuParser::InitFun()
|
|||
DefineFun(QStringLiteral("log2"), Log2);
|
||||
DefineFun(QStringLiteral("log10"), Log10);
|
||||
DefineFun(QStringLiteral("log"), Log10);
|
||||
DefineFun(QStringLiteral("ln"), qLn);
|
||||
DefineFun(QStringLiteral("ln"), QLN_FUN);
|
||||
// misc
|
||||
DefineFun(QStringLiteral("exp"), qExp);
|
||||
DefineFun(QStringLiteral("sqrt"), qSqrt);
|
||||
DefineFun(QStringLiteral("exp"), QEXP_FUN);
|
||||
DefineFun(QStringLiteral("sqrt"), QSQRT_FUN);
|
||||
DefineFun(QStringLiteral("sign"), Sign);
|
||||
DefineFun(QStringLiteral("rint"), Rint);
|
||||
DefineFun(QStringLiteral("r2cm"), R2CM);
|
||||
|
|
Loading…
Reference in New Issue
Block a user