<QtMath> - Generic Math Functions▲
-
Header: QtMath
-
Group: <QtMath> is part of funclists
Detailed Description▲
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:
Constant |
Description |
---|---|
M_E |
The base of the natural logarithms, e = exp(1) |
M_LOG2E |
The base-two logarithm of e |
M_LOG10E |
The base-ten logarithm of e |
M_LN2 |
The natural logarithm of two |
M_LN10 |
The natural logarithm of ten |
M_PI |
The ratio of a circle's circumference to diameter, π |
M_PI_2 |
Half M_PI, π / 2 |
M_PI_4 |
Quarter M_PI, π / 4 |
M_1_PI |
The inverse of M_PI, 1 / π |
M_2_PI |
Twice the inverse of M_PI, 2 / π |
M_2_SQRTPI |
Two divided by the square root of pi, 2 / √π |
M_SQRT2 |
The square root of two, √2 |
M_SQRT1_2 |
The square roof of half, 1 / √2 |
<Unknown command>pagekeywordsmath trigonometry qmath floor ceiling absolute sine cosine tangent inverse tan exponent power natural logarithm pi
Function Documentation▲
qreal qAcos(qreal v)▲
Returns the arccosine of v as an angle in radians. Arccosine is the inverse operation of cosine.
See Also▲
qreal qAsin(qreal v)▲
Returns the arcsine of v as an angle in radians. Arcsine is the inverse operation of sine.
See Also▲
qreal qAtan2(qreal y, qreal x)▲
Returns the arctangent of a point specified by the coordinates y and x. This function will return the angle (argument) of that point.
See Also▲
See also qAtan()
qreal qAtan(qreal v)▲
Returns the arctangent of v as an angle in radians. Arctangent is the inverse operation of tangent.
See Also▲
int qCeil(qreal v)▲
Return the ceiling of the value v.
The ceiling is the smallest integer that is not less than v. For example, if v is 41.2, then the ceiling is 42.
See Also▲
See also qFloor()
qreal qCos(qreal v)▲
[since 5.1] int qDegreesToRadians(float degrees)▲
This function converts the degrees in float to radians.
Example:
float
degrees =
180.0
f
float
radians =
qDegreesToRadians(degrees)
This function was introduced in Qt 5.1.
See Also▲
See also qRadiansToDegrees()
[since 5.1] int qDegreesToRadians(double degrees)▲
This function converts the degrees in double to radians.
Example:
double
degrees =
180.0
double
radians =
qDegreesToRadians(degrees)
This function was introduced in Qt 5.1.
See Also▲
See also qRadiansToDegrees()
qreal qExp(qreal v)▲
qreal qFabs(qreal v)▲
Returns the absolute value of v as a qreal.
int qFloor(qreal v)▲
Return the floor of the value v.
The floor is the largest integer that is not greater than v. For example, if v is 41.2, then the floor is 41.
See Also▲
See also qCeil()
qreal qLn(qreal v)▲
qreal qPow(qreal x, qreal y)▲
Returns the value of x raised to the power of y. That is, x is the base and y is the exponent.
See Also▲
See also qSqrt()
[since 5.1] int qRadiansToDegrees(float radians)▲
This function converts the radians in float to degrees.
Example:
float
radians =
float
(M_PI)
float
degrees =
qRadiansToDegrees(radians)
This function was introduced in Qt 5.1.
See Also▲
See also qDegreesToRadians()
[since 5.1] int qRadiansToDegrees(double radians)▲
This function converts the radians in double to degrees.
Example:
double
radians =
M_PI
double
degrees =
qRadiansToDegrees(radians)
This function was introduced in Qt 5.1.
See Also▲
See also qDegreesToRadians()
qreal qSin(qreal v)▲
qreal qSqrt(qreal v)▲
Returns the square root of v. This function returns a NaN if v is a negative number.
See Also▲
See also qPow()