<QtMath> - Generic Math Functions

The <QtMath> header file provides various math functions. More...

These functions are partly convenience definitions for basic math operations not available in the C or Standard Template Libraries.

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:

ConstantDescription
M_EThe base of the natural logarithms, e = exp(1)
M_LOG2EThe base-two logarithm of e
M_LOG10EThe base-ten logarithm of e
M_LN2The natural logarithm of two
M_LN10The natural logarithm of ten
M_PIThe ratio of a circle's circumference to diameter, π
M_PI_2Half M_PI, π / 2
M_PI_4Quarter M_PI, π / 4
M_1_PIThe inverse of M_PI, 1 / π
M_2_PITwice the inverse of M_PI, 2 / π
M_2_SQRTPITwo divided by the square root of pi, 2 / √π
M_SQRT2The square root of two, √2
M_SQRT1_2The square roof of half, 1 / √2