The <QtMath> header file provides various math functions.
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:
Returns the arccosine of
vas an angle in radians. Arccosine is the inverse operation of cosine.See also
qAtan()qAsin()qCos()Returns the arcsine of
vas an angle in radians. Arcsine is the inverse operation of sine.See also
qSin()qAtan()qAcos()Returns the arctangent of
vas an angle in radians. Arctangent is the inverse operation of tangent.See also
qTan()qAcos()qAsin()Returns the arctangent of a point specified by the coordinates
yandx. This function will return the angle (argument) of that point.See also
qAtan()Return the ceiling of the value
v.The ceiling is the smallest integer that is not less than
v. For example, ifvis 41.2, then the ceiling is 42.See also
qFloor()Returns the cosine of an angle
vin radians.See also
qSin()qTan()This function converts the
degreesin float to radians.Example:
float degrees = 180.0f float radians = qDegreesToRadians(degrees)See also
qRadiansToDegrees()This function converts the
degreesin double to radians.Example:
double degrees = 180.0 double radians = qDegreesToRadians(degrees)See also
qRadiansToDegrees()Returns the exponential function of
eto the power ofv.See also
qLn()Returns the absolute value of
vas a qreal.Return the floor of the value
v.The floor is the largest integer that is not greater than
v. For example, ifvis 41.2, then the floor is 41.See also
qCeil()Returns the natural logarithm of
v. Natural logarithm uses base e.See also
qExp()This function returns the nearest power of two greater than
value. For 0 it returns 1, and for values larger than or equal to 2^31 it returns 0.This function returns the nearest power of two greater than
value. For 0 it returns 1, and for values larger than or equal to 2^63 it returns 0.This is an overloaded function.
This function returns the nearest power of two greater than
value. For negative values it returns 0.This is an overloaded function.
This function returns the nearest power of two greater than
value. For negative values it returns 0.Returns the value of
xraised to the power ofy. That is,xis the base andyis the exponent.See also
qSqrt()This function converts the
radiansin float to degrees.Example:
float radians = float(M_PI) float degrees = qRadiansToDegrees(radians)See also
qDegreesToRadians()This function converts the
radiansin double to degrees.Example:
double radians = M_PI double degrees = qRadiansToDegrees(radians)See also
qDegreesToRadians()Returns the sine of the angle
vin radians.See also
qCos()qTan()Returns the square root of
v. This function returns a NaN ifvis a negative number.See also
qPow()Returns the tangent of an angle
vin radians.See also
qSin()qCos()
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.