diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:33:53 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:33:53 (GMT) |
commit | 1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd (patch) | |
tree | 71c03d33b9c36fb78a6bc11b8994720ca3823f79 /src/corelib/kernel/qmath.h | |
parent | 696099f8e3179787114df40d6ce6fef97bfa33dc (diff) | |
parent | c0b81480b2909b18ac15bdd124a562ae005c2f41 (diff) | |
download | Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.zip Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.gz Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.bz2 |
Merge commit 'c0b81480b2909b18ac15bdd124a562ae005c2f41' into origin-4.6
Diffstat (limited to 'src/corelib/kernel/qmath.h')
-rw-r--r-- | src/corelib/kernel/qmath.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index a9e4378..820f424 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -76,6 +76,16 @@ inline int qFloor(qreal v) return int(floor(v)); } +inline qreal qFabs(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return fabsf(float(v)); + else +#endif + return fabs(v); +} + inline qreal qSin(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -96,6 +106,16 @@ inline qreal qCos(qreal v) return cos(v); } +inline qreal qTan(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return tanf(float(v)); + else +#endif + return tan(v); +} + inline qreal qAcos(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -106,6 +126,36 @@ inline qreal qAcos(qreal v) return acos(v); } +inline qreal qAsin(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return asinf(float(v)); + else +#endif + return asin(v); +} + +inline qreal qAtan(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atanf(float(v)); + else +#endif + return atan(v); +} + +inline qreal qAtan2(qreal x, qreal y) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atan2f(float(x), float(y)); + else +#endif + return atan2(x, y); +} + inline qreal qSqrt(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -126,6 +176,13 @@ inline qreal qLn(qreal v) return log(v); } +inline qreal qExp(qreal v) +{ + // only one signature + // exists, exp(double) + return exp(v); +} + inline qreal qPow(qreal x, qreal y) { #ifdef QT_USE_MATH_H_FLOATS |