Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmath.h File Reference

(bc83d91d4e3575ba688d65e12860c05b3fb1dcbd)

#include <QtCore/qglobal.h>
#include <QtCore/qalgorithms.h>
#include <QtCore/qnumeric.h>
#include <cmath>
Include dependency graph for qmath.h:

Go to the source code of this file.

Classes

struct  QtPrivate::QHypotType< R, F >
class  QtPrivate::QHypotHelper< T >

Namespaces

namespace  QtPrivate

Macros

#define QT_SINE_TABLE_SIZE   256
#define M_E   (2.7182818284590452354)
#define M_LOG2E   (1.4426950408889634074)
#define M_LOG10E   (0.43429448190325182765)
#define M_LN2   (0.69314718055994530942)
#define M_LN10   (2.30258509299404568402)
#define M_PI   (3.14159265358979323846)
#define M_PI_2   (1.57079632679489661923)
#define M_PI_4   (0.78539816339744830962)
#define M_1_PI   (0.31830988618379067154)
#define M_2_PI   (0.63661977236758134308)
#define M_2_SQRTPI   (1.12837916709551257390)
#define M_SQRT2   (1.41421356237309504880)
#define M_SQRT1_2   (0.70710678118654752440)

Functions

template<typename T>
int qCeil (T v)
template<typename T>
int qFloor (T v)
template<typename T>
auto qFabs (T v)
template<typename T>
auto qSin (T v)
template<typename T>
auto qCos (T v)
template<typename T>
auto qTan (T v)
template<typename T>
auto qAcos (T v)
template<typename T>
auto qAsin (T v)
template<typename T>
auto qAtan (T v)
template<typename T1, typename T2>
auto qAtan2 (T1 y, T2 x)
template<typename T>
auto qSqrt (T v)
template<typename F, typename ... Fs>
auto qHypot (F first, Fs... rest)
template<typename Tx, typename Ty>
auto qHypot (Tx x, Ty y)
template<typename T>
auto qLn (T v)
template<typename T>
auto qExp (T v)
template<typename T1, typename T2>
auto qPow (T1 x, T2 y)
qreal qFastSin (qreal x)
qreal qFastCos (qreal x)
constexpr float qDegreesToRadians (float degrees)
constexpr double qDegreesToRadians (double degrees)
constexpr long double qDegreesToRadians (long double degrees)
template<typename T, std::enable_if_t< std::is_integral_v< T >, bool > = true>
constexpr double qDegreesToRadians (T degrees)
constexpr float qRadiansToDegrees (float radians)
constexpr double qRadiansToDegrees (double radians)
constexpr long double qRadiansToDegrees (long double radians)
constexpr quint32 qNextPowerOfTwo (quint32 v)
constexpr quint64 qNextPowerOfTwo (quint64 v)
constexpr quint32 qNextPowerOfTwo (qint32 v)
constexpr quint64 qNextPowerOfTwo (qint64 v)
constexpr unsigned long qNextPowerOfTwo (unsigned long v)
constexpr unsigned long qNextPowerOfTwo (long v)

Variables

Q_CORE_EXPORT const qreal qt_sine_table [QT_SINE_TABLE_SIZE]

Macro Definition Documentation

◆ M_1_PI

#define M_1_PI   (0.31830988618379067154)

Definition at line 213 of file qmath.h.

◆ M_2_PI

#define M_2_PI   (0.63661977236758134308)

Definition at line 217 of file qmath.h.

◆ M_2_SQRTPI

#define M_2_SQRTPI   (1.12837916709551257390)

Definition at line 221 of file qmath.h.

◆ M_E

#define M_E   (2.7182818284590452354)

Definition at line 181 of file qmath.h.

◆ M_LN10

#define M_LN10   (2.30258509299404568402)

Definition at line 197 of file qmath.h.

◆ M_LN2

#define M_LN2   (0.69314718055994530942)

Definition at line 193 of file qmath.h.

◆ M_LOG10E

#define M_LOG10E   (0.43429448190325182765)

Definition at line 189 of file qmath.h.

◆ M_LOG2E

#define M_LOG2E   (1.4426950408889634074)

Definition at line 185 of file qmath.h.

◆ M_PI

#define M_PI   (3.14159265358979323846)

Definition at line 201 of file qmath.h.

◆ M_PI_2

#define M_PI_2   (1.57079632679489661923)

Definition at line 205 of file qmath.h.

◆ M_PI_4

#define M_PI_4   (0.78539816339744830962)

Definition at line 209 of file qmath.h.

◆ M_SQRT1_2

#define M_SQRT1_2   (0.70710678118654752440)

Definition at line 229 of file qmath.h.

◆ M_SQRT2

#define M_SQRT2   (1.41421356237309504880)

Definition at line 225 of file qmath.h.

◆ QT_SINE_TABLE_SIZE

#define QT_SINE_TABLE_SIZE   256

Definition at line 24 of file qmath.h.

Function Documentation

◆ qAcos()

template<typename T>
auto qAcos ( T v)

Definition at line 64 of file qmath.h.

◆ qAsin()

template<typename T>
auto qAsin ( T v)

Definition at line 70 of file qmath.h.

◆ qAtan()

template<typename T>
auto qAtan ( T v)

Definition at line 76 of file qmath.h.

◆ qAtan2()

template<typename T1, typename T2>
auto qAtan2 ( T1 y,
T2 x )

Definition at line 82 of file qmath.h.

◆ qCeil()

template<typename T>
int qCeil ( T v)

Definition at line 28 of file qmath.h.

◆ qCos()

template<typename T>
auto qCos ( T v)

Definition at line 52 of file qmath.h.

◆ qDegreesToRadians() [1/4]

double qDegreesToRadians ( double degrees)
inlineconstexpr

Definition at line 257 of file qmath.h.

Referenced by qDegreesToRadians().

Here is the caller graph for this function:

◆ qDegreesToRadians() [2/4]

float qDegreesToRadians ( float degrees)
inlineconstexpr

Definition at line 252 of file qmath.h.

◆ qDegreesToRadians() [3/4]

long double qDegreesToRadians ( long double degrees)
inlineconstexpr

Definition at line 262 of file qmath.h.

◆ qDegreesToRadians() [4/4]

template<typename T, std::enable_if_t< std::is_integral_v< T >, bool > = true>
double qDegreesToRadians ( T degrees)
inlineconstexpr

Definition at line 268 of file qmath.h.

References qDegreesToRadians().

Here is the call graph for this function:

◆ qExp()

template<typename T>
auto qExp ( T v)

Definition at line 166 of file qmath.h.

◆ qFabs()

template<typename T>
auto qFabs ( T v)

Definition at line 40 of file qmath.h.

◆ qFastCos()

qreal qFastCos ( qreal x)
inline

Definition at line 242 of file qmath.h.

◆ qFastSin()

qreal qFastSin ( qreal x)
inline

Definition at line 232 of file qmath.h.

◆ qFloor()

template<typename T>
int qFloor ( T v)

Definition at line 34 of file qmath.h.

◆ qHypot() [1/2]

template<typename F, typename ... Fs>
auto qHypot ( F first,
Fs... rest )

Definition at line 137 of file qmath.h.

◆ qHypot() [2/2]

template<typename Tx, typename Ty>
auto qHypot ( Tx x,
Ty y )

Definition at line 144 of file qmath.h.

◆ qLn()

template<typename T>
auto qLn ( T v)

Definition at line 160 of file qmath.h.

◆ qNextPowerOfTwo() [1/6]

unsigned long qNextPowerOfTwo ( long v)
inlineconstexpr

Definition at line 319 of file qmath.h.

◆ qNextPowerOfTwo() [2/6]

quint32 qNextPowerOfTwo ( qint32 v)
inlineconstexpr

Definition at line 304 of file qmath.h.

◆ qNextPowerOfTwo() [3/6]

quint64 qNextPowerOfTwo ( qint64 v)
inlineconstexpr

Definition at line 309 of file qmath.h.

◆ qNextPowerOfTwo() [4/6]

quint32 qNextPowerOfTwo ( quint32 v)
inlineconstexpr

Definition at line 292 of file qmath.h.

◆ qNextPowerOfTwo() [5/6]

quint64 qNextPowerOfTwo ( quint64 v)
inlineconstexpr

Definition at line 298 of file qmath.h.

◆ qNextPowerOfTwo() [6/6]

unsigned long qNextPowerOfTwo ( unsigned long v)
inlineconstexpr

Definition at line 314 of file qmath.h.

◆ qPow()

template<typename T1, typename T2>
auto qPow ( T1 x,
T2 y )

Definition at line 172 of file qmath.h.

◆ qRadiansToDegrees() [1/3]

double qRadiansToDegrees ( double radians)
inlineconstexpr

Definition at line 278 of file qmath.h.

Referenced by QtGradientWidget::mousePressEvent().

Here is the caller graph for this function:

◆ qRadiansToDegrees() [2/3]

float qRadiansToDegrees ( float radians)
inlineconstexpr

Definition at line 273 of file qmath.h.

◆ qRadiansToDegrees() [3/3]

long double qRadiansToDegrees ( long double radians)
inlineconstexpr

Definition at line 283 of file qmath.h.

◆ qSin()

template<typename T>
auto qSin ( T v)

Definition at line 46 of file qmath.h.

◆ qSqrt()

template<typename T>
auto qSqrt ( T v)

Definition at line 88 of file qmath.h.

◆ qTan()

template<typename T>
auto qTan ( T v)

Definition at line 58 of file qmath.h.

Variable Documentation

◆ qt_sine_table

Q_CORE_EXPORT const qreal qt_sine_table[QT_SINE_TABLE_SIZE]
extern

Definition at line 10 of file qmath.cpp.