diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2017-03-22 14:46:27 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-03-29 16:07:14 +0000 |
commit | b4c85e8a2ac17bf7cfce40c486d3d208def1ce89 (patch) | |
tree | 3f9b59d218432eb08496fa1e857effd4dc2a5a7e /src/corelib/kernel | |
parent | 8d49df2172aaffaf49fbad0bc4d522d34662b583 (diff) |
Document M_PI and friends in <QtMath>
These symbols should at least be mentioned in the documentation.
Also comment on the option of using template variables for them once
we haev support for C++14
Change-Id: Ia40f9b89d9d8a38536a2e51ae3f174b8f16ca7d6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qmath.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmath.qdoc | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index 773884047a..68f6a65c87 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -149,6 +149,8 @@ inline qreal qPow(qreal x, qreal y) return pow(x, y); } +// TODO: use template variables (e.g. Qt::pi<type>) for these once we have C++14 support: + #ifndef M_E #define M_E (2.7182818284590452354) #endif diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc index 3a692d5935..a2e24e925b 100644 --- a/src/corelib/kernel/qmath.qdoc +++ b/src/corelib/kernel/qmath.qdoc @@ -35,7 +35,24 @@ These functions are partly convenience definitions for basic math operations not available in the C or Standard Template Libraries. - \pagekeywords math trigonometry qmath floor ceiling absolute sine cosine tangent inverse tan exponent power natural logarithm + The header also ensures some constants specified in POSIX, but not present + in C++ standards (so absent from <math.h> on some platforms), are defined: + + \value M_E The base of the natural logarithms, e = exp(1) + \value M_LOG2E The base-two logarithm of e + \value M_LOG10E The base-ten logarithm of e + \value M_LN2 The natural logarithm of two + \value M_LN10 The natural logarithm of ten + \value M_PI The ratio of a circle's circumference to diameter, \unicode{0x3C0} + \value M_PI_2 Half M_PI, \unicode{0x3C0} / 2 + \value M_PI_4 Quarter M_PI, \unicode{0x3C0} / 4 + \value M_1_PI The inverse of M_PI, 1 / \unicode{0x3C0} + \value M_2_PI Twice the inverse of M_PI, 2 / \unicode{0x3C0} + \value M_2_SQRTPI Two divided by the square root of pi, 2 / \unicode{0x221A}\unicode{0x3C0} + \value M_SQRT2 The square root of two, \unicode{0x221A}2 + \value M_SQRT1_2 The square roof of half, 1 / \unicode{0x221A}2 + + \pagekeywords math trigonometry qmath floor ceiling absolute sine cosine tangent inverse tan exponent power natural logarithm pi */ /*! |