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

(df97b6b2de6282bd6422f1e531a42475dadc980d)

#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 QtPrivate::qConstexprNextPowerOfTwo (quint32 v)
 
constexpr quint64 QtPrivate::qConstexprNextPowerOfTwo (quint64 v)
 
constexpr quint32 QtPrivate::qConstexprNextPowerOfTwo (qint32 v)
 
constexpr quint64 QtPrivate::qConstexprNextPowerOfTwo (qint64 v)
 
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 212 of file qmath.h.

◆ M_2_PI

#define M_2_PI   (0.63661977236758134308)

Definition at line 216 of file qmath.h.

◆ M_2_SQRTPI

#define M_2_SQRTPI   (1.12837916709551257390)

Definition at line 220 of file qmath.h.

◆ M_E

#define M_E   (2.7182818284590452354)

Definition at line 180 of file qmath.h.

◆ M_LN10

#define M_LN10   (2.30258509299404568402)

Definition at line 196 of file qmath.h.

◆ M_LN2

#define M_LN2   (0.69314718055994530942)

Definition at line 192 of file qmath.h.

◆ M_LOG10E

#define M_LOG10E   (0.43429448190325182765)

Definition at line 188 of file qmath.h.

◆ M_LOG2E

#define M_LOG2E   (1.4426950408889634074)

Definition at line 184 of file qmath.h.

◆ M_PI

#define M_PI   (3.14159265358979323846)

Definition at line 200 of file qmath.h.

◆ M_PI_2

#define M_PI_2   (1.57079632679489661923)

Definition at line 204 of file qmath.h.

◆ M_PI_4

#define M_PI_4   (0.78539816339744830962)

Definition at line 208 of file qmath.h.

◆ M_SQRT1_2

#define M_SQRT1_2   (0.70710678118654752440)

Definition at line 228 of file qmath.h.

◆ M_SQRT2

#define M_SQRT2   (1.41421356237309504880)

Definition at line 224 of file qmath.h.

◆ QT_SINE_TABLE_SIZE

#define QT_SINE_TABLE_SIZE   256

Definition at line 23 of file qmath.h.

Function Documentation

◆ qAcos()

template<typename T>
auto qAcos ( T v)

Definition at line 63 of file qmath.h.

◆ qAsin()

template<typename T>
auto qAsin ( T v)

Definition at line 69 of file qmath.h.

◆ qAtan()

template<typename T>
auto qAtan ( T v)

Definition at line 75 of file qmath.h.

◆ qAtan2()

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

Definition at line 81 of file qmath.h.

◆ qCeil()

template<typename T>
int qCeil ( T v)

Definition at line 27 of file qmath.h.

◆ qCos()

template<typename T>
auto qCos ( T v)

Definition at line 51 of file qmath.h.

◆ qDegreesToRadians() [1/4]

double qDegreesToRadians ( double degrees)
inlineconstexpr

Definition at line 256 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 251 of file qmath.h.

◆ qDegreesToRadians() [3/4]

long double qDegreesToRadians ( long double degrees)
inlineconstexpr

Definition at line 261 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 267 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 165 of file qmath.h.

◆ qFabs()

template<typename T>
auto qFabs ( T v)

Definition at line 39 of file qmath.h.

◆ qFastCos()

qreal qFastCos ( qreal x)
inline

Definition at line 241 of file qmath.h.

◆ qFastSin()

qreal qFastSin ( qreal x)
inline

Definition at line 231 of file qmath.h.

◆ qFloor()

template<typename T>
int qFloor ( T v)

Definition at line 33 of file qmath.h.

◆ qHypot() [1/2]

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

Definition at line 136 of file qmath.h.

◆ qHypot() [2/2]

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

Definition at line 143 of file qmath.h.

◆ qLn()

template<typename T>
auto qLn ( T v)

Definition at line 159 of file qmath.h.

◆ qNextPowerOfTwo() [1/6]

unsigned long qNextPowerOfTwo ( long v)
inlineconstexpr

Definition at line 369 of file qmath.h.

◆ qNextPowerOfTwo() [2/6]

quint32 qNextPowerOfTwo ( qint32 v)
inlineconstexpr

Definition at line 354 of file qmath.h.

◆ qNextPowerOfTwo() [3/6]

quint64 qNextPowerOfTwo ( qint64 v)
inlineconstexpr

Definition at line 359 of file qmath.h.

◆ qNextPowerOfTwo() [4/6]

quint32 qNextPowerOfTwo ( quint32 v)
inlineconstexpr

Definition at line 326 of file qmath.h.

◆ qNextPowerOfTwo() [5/6]

quint64 qNextPowerOfTwo ( quint64 v)
inlineconstexpr

Definition at line 340 of file qmath.h.

◆ qNextPowerOfTwo() [6/6]

unsigned long qNextPowerOfTwo ( unsigned long v)
inlineconstexpr

Definition at line 364 of file qmath.h.

◆ qPow()

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

Definition at line 171 of file qmath.h.

◆ qRadiansToDegrees() [1/3]

double qRadiansToDegrees ( double radians)
inlineconstexpr

Definition at line 277 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 272 of file qmath.h.

◆ qRadiansToDegrees() [3/3]

long double qRadiansToDegrees ( long double radians)
inlineconstexpr

Definition at line 282 of file qmath.h.

◆ qSin()

template<typename T>
auto qSin ( T v)

Definition at line 45 of file qmath.h.

◆ qSqrt()

template<typename T>
auto qSqrt ( T v)

Definition at line 87 of file qmath.h.

◆ qTan()

template<typename T>
auto qTan ( T v)

Definition at line 57 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 9 of file qmath.cpp.