# <QtMath> - Generic Math Functions¶

File provides various math functions

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:

• M_E

• The base of the natural logarithms, e = exp(1)

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.

`qFloor()`

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.

`qCeil()`

Returns the absolute value of `v` as a qreal.

Returns the sine of the angle `v` in radians.

`qCos()` `qTan()`

Returns the cosine of an angle `v` in radians.

`qSin()` `qTan()`

Returns the tangent of an angle `v` in radians.

`qSin()` `qCos()`

Returns the arccosine of `v` as an angle in radians. Arccosine is the inverse operation of cosine.

`qAtan()` `qAsin()` `qCos()`

Returns the arcsine of `v` as an angle in radians. Arcsine is the inverse operation of sine.

`qSin()` `qAtan()` `qAcos()`

Returns the arctangent of `v` as an angle in radians. Arctangent is the inverse operation of tangent.

`qTan()` `qAcos()` `qAsin()`

Returns the arctangent of a point specified by the coordinates `y` and `x` . This function will return the angle (argument) of that point.

`qAtan()`

Returns the square root of `v` . This function returns a NaN if `v` is a negative number.

`qPow()`

Returns the natural logarithm of `v` . Natural logarithm uses base e.

`qExp()`

Returns the exponential function of `e` to the power of `v` .

`qLn()`

Returns the value of `x` raised to the power of `y` . That is, `x` is the base and `y` is the exponent.

`qSqrt()`

This function converts the `degrees` in float to radians.

Example:

```float degrees = 180.0f
```

`qRadiansToDegrees()`

This function converts the `degrees` in double to radians.

Example:

```double degrees = 180.0
```

`qRadiansToDegrees()`

This function converts the `radians` in float to degrees.

Example:

```float radians = float(M_PI)
```

`qDegreesToRadians()`

This function converts the `radians` in double to degrees.

Example:

```double radians = M_PI
```

`qDegreesToRadians()`

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 negative values 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 function returns the nearest power of two greater than `value` . For negative values it returns 0.