QtBase  v6.3.1
Macros | Functions
qnumeric.h File Reference
#include <QtCore/qglobal.h>
#include <cmath>
#include <limits>
#include <type_traits>
Include dependency graph for qnumeric.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Q_INFINITY   (QT_PREPEND_NAMESPACE(qInf)())
 
#define Q_QNAN   (QT_PREPEND_NAMESPACE(qQNaN)())
 

Functions

template<typename T >
constexpr QT_BEGIN_NAMESPACE std::enable_if< std::is_integral< T >::value, bool >::type qIsInf (T)
 
template<typename T >
constexpr std::enable_if< std::is_integral< T >::value, bool >::type qIsNaN (T)
 
template<typename T >
constexpr std::enable_if< std::is_integral< T >::value, bool >::type qIsFinite (T)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf (double d)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN (double d)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite (double d)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify (double val)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf (float f)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN (float f)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite (float f)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify (float val)
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN ()
 
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf ()
 
Q_CORE_EXPORT quint32 qFloatDistance (float a, float b)
 
Q_CORE_EXPORT quint64 qFloatDistance (double a, double b)
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >, bool > qAddOverflow (T v1, T v2, T *r)
 
template<typename T >
std::enable_if_t< std::is_signed_v< T >, bool > qAddOverflow (T v1, T v2, T *r)
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >, bool > qSubOverflow (T v1, T v2, T *r)
 
template<typename T >
std::enable_if_t< std::is_signed_v< T >, bool > qSubOverflow (T v1, T v2, T *r)
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >||std::is_signed_v< T >, bool > qMulOverflow (T v1, T v2, T *r)
 
template<typename T , T V2>
bool qAddOverflow (T v1, std::integral_constant< T, V2 >, T *r)
 
template<auto V2, typename T >
bool qAddOverflow (T v1, T *r)
 
template<typename T , T V2>
bool qSubOverflow (T v1, std::integral_constant< T, V2 >, T *r)
 
template<auto V2, typename T >
bool qSubOverflow (T v1, T *r)
 
template<typename T , T V2>
bool qMulOverflow (T v1, std::integral_constant< T, V2 >, T *r)
 
template<auto V2, typename T >
bool qMulOverflow (T v1, T *r)
 

Macro Definition Documentation

◆ Q_INFINITY

#define Q_INFINITY   (QT_PREPEND_NAMESPACE(qInf)())

Definition at line 106 of file qnumeric.h.

◆ Q_QNAN

#define Q_QNAN   (QT_PREPEND_NAMESPACE(qQNaN)())

Definition at line 110 of file qnumeric.h.

Function Documentation

◆ qAddOverflow() [1/4]

template<typename T , T V2>
template< typename T, T V2 > bool qAddOverflow ( T  v1,
std::integral_constant< T, V2 >  ,
T r 
)
Since
6.1

Definition at line 284 of file qnumeric.h.

Here is the call graph for this function:

◆ qAddOverflow() [2/4]

template<auto V2, typename T >
template< auto V2, typename T > bool qAddOverflow ( T  v1,
T r 
)
Since
6.1

Definition at line 289 of file qnumeric.h.

Here is the call graph for this function:

◆ qAddOverflow() [3/4]

template<typename T >
std::enable_if_t<std::is_unsigned_v<T>, bool> qAddOverflow ( T  v1,
T  v2,
T r 
)
inline

Definition at line 144 of file qnumeric.h.

Here is the caller graph for this function:

◆ qAddOverflow() [4/4]

template<typename T >
std::enable_if_t<std::is_signed_v<T>, bool> qAddOverflow ( T  v1,
T  v2,
T r 
)
inline

Definition at line 152 of file qnumeric.h.

◆ qFloatDistance() [1/2]

Q_CORE_EXPORT quint64 qFloatDistance ( double  a,
double  b 
)

◆ qFloatDistance() [2/2]

Q_CORE_EXPORT quint32 qFloatDistance ( float  a,
float  b 
)

◆ qFpClassify() [1/2]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify ( double  val)

Definition at line 123 of file qnumeric.cpp.

◆ qFpClassify() [2/2]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify ( float  val)

Definition at line 124 of file qnumeric.cpp.

◆ qInf()

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf ( )
Here is the caller graph for this function:

◆ qIsFinite() [1/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite ( double  d)

◆ qIsFinite() [2/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite ( float  f)

◆ qIsFinite() [3/3]

template<typename T >
constexpr std::enable_if<std::is_integral<T>::value, bool>::type qIsFinite ( T  )
constexpr

Definition at line 85 of file qnumeric.h.

◆ qIsInf() [1/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf ( double  d)

◆ qIsInf() [2/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf ( float  f)

◆ qIsInf() [3/3]

template<typename T >
constexpr QT_BEGIN_NAMESPACE std::enable_if<std::is_integral<T>::value, bool>::type qIsInf ( T  )
constexpr

Definition at line 79 of file qnumeric.h.

◆ qIsNaN() [1/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN ( double  d)

◆ qIsNaN() [2/3]

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN ( float  f)

◆ qIsNaN() [3/3]

template<typename T >
constexpr std::enable_if<std::is_integral<T>::value, bool>::type qIsNaN ( T  )
constexpr

Definition at line 82 of file qnumeric.h.

◆ qMulOverflow() [1/3]

template<typename T , T V2>
template< typename T, T V2 > bool qMulOverflow ( T  v1,
std::integral_constant< T, V2 >  ,
T r 
)
Since
6.1

Definition at line 304 of file qnumeric.h.

Here is the call graph for this function:

◆ qMulOverflow() [2/3]

template<auto V2, typename T >
template< auto V2, typename T > bool qMulOverflow ( T  v1,
T r 
)
Since
6.1

Definition at line 351 of file qnumeric.h.

Here is the call graph for this function:

◆ qMulOverflow() [3/3]

template<typename T >
std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> qMulOverflow ( T  v1,
T  v2,
T r 
)
inline

Definition at line 213 of file qnumeric.h.

Here is the caller graph for this function:

◆ qQNaN()

Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN ( )
Here is the caller graph for this function:

◆ qSubOverflow() [1/4]

template<typename T , T V2>
template< typename T, T V2 > bool qSubOverflow ( T  v1,
std::integral_constant< T, V2 >  ,
T r 
)
Since
6.1

Definition at line 294 of file qnumeric.h.

Here is the call graph for this function:

◆ qSubOverflow() [2/4]

template<auto V2, typename T >
template< auto V2, typename T > bool qSubOverflow ( T  v1,
T r 
)
Since
6.1

Definition at line 299 of file qnumeric.h.

Here is the call graph for this function:

◆ qSubOverflow() [3/4]

template<typename T >
std::enable_if_t<std::is_unsigned_v<T>, bool> qSubOverflow ( T  v1,
T  v2,
T r 
)
inline

Definition at line 184 of file qnumeric.h.

Here is the caller graph for this function:

◆ qSubOverflow() [4/4]

template<typename T >
std::enable_if_t<std::is_signed_v<T>, bool> qSubOverflow ( T  v1,
T  v2,
T r 
)
inline

Definition at line 192 of file qnumeric.h.