![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\keyword 16-bit Floating Point Support\inmodule QtCore \inheaderfile QFloat16 More...
#include <qfloat16.h>
Public Types | |
| using | NativeType = QtPrivate::NativeFloat16Type |
| using | NearestFloat = std::conditional_t<IsNative, NativeType, float> |
Public Member Functions | |
| qfloat16 (Qt::Initialization) noexcept | |
| constexpr | qfloat16 () noexcept |
| qfloat16 (float ff) noexcept | |
| operator float () const noexcept | |
| template<typename T, typename = std::enable_if_t<std::is_arithmetic_v<T> && !std::is_same_v<T, NearestFloat>>> | |
| constexpr | qfloat16 (T valuevalue) noexcept |
| bool | isInf () const noexcept |
| bool | isNaN () const noexcept |
| bool | isFinite () const noexcept |
| Q_CORE_EXPORT int | fpClassify () const noexcept |
| qfloat16 | copySign (qfloat16 sign) const noexcept |
| constexpr bool | isNormal () const noexcept |
| QF16_CONSTEXPR qfloat16 | operator++ (int) noexcept |
| QF16_CONSTEXPR qfloat16 & | operator++ () noexcept |
| QF16_CONSTEXPR qfloat16 | operator-- (int) noexcept |
| QF16_CONSTEXPR qfloat16 & | operator-- () noexcept |
Static Public Member Functions | |
| static constexpr qfloat16 | _limit_epsilon () noexcept |
| static constexpr qfloat16 | _limit_min () noexcept |
| static constexpr qfloat16 | _limit_denorm_min () noexcept |
| static constexpr qfloat16 | _limit_max () noexcept |
| static constexpr qfloat16 | _limit_lowest () noexcept |
| static constexpr qfloat16 | _limit_infinity () noexcept |
| static constexpr qfloat16 | _limit_quiet_NaN () noexcept |
Static Public Attributes | |
| static constexpr bool | IsNative = QFLOAT16_IS_NATIVE |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | qIsInfqIsInf (qfloat16 ff)(float) |
Returns true if the qfloat16 {f} is equivalent to infinity. | |
| bool | qIsNaNqIsNaN (qfloat16 ff)(float) |
Returns true if the qfloat16 {f} is not a number (NaN). | |
| bool | qIsFiniteqIsFinite (qfloat16 ff)(float) |
Returns true if the qfloat16 {f} is a finite number. | |
| int | qFpClassifyqFpClassify (qfloat16 valval)(float) |
| int | qRoundqRound (qfloat16 valuevalue)(float) |
| Rounds value to the nearest integer. | |
| qint64 | qRound64qRound64 (qfloat16 valuevalue)(float) |
| Rounds value to the nearest 64-bit integer. | |
| bool | qFuzzyCompareqFuzzyCompare (qfloat16 p1, qfloat16 p2)(float, float) |
Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false. | |
| Q_CORE_EXPORT void | qFloatToFloat16 (qfloat16 *out, const float *inin, qsizetype lenlen) noexcept |
| Q_CORE_EXPORT void | qFloatFromFloat16 (float *out, const qfloat16 *inin, qsizetype lenlen) noexcept |
\keyword 16-bit Floating Point Support
\inmodule QtCore \inheaderfile QFloat16
Provides 16-bit floating point support.
\compares partial \compareswith partial float double {long double} qint8 quint8 qint16 quint16 \ qint32 quint32 long {unsigned long} qint64 quint64 \endcompareswith \compareswith partial qint128 quint128 Comparison with 128-bit integral types is only supported if Qt provides these types. \endcompareswith
The qfloat16 class provides support for half-precision (16-bit) floating point data. It is fully compliant with IEEE 754 as a storage type. This implies that any arithmetic operation on a qfloat16 instance results in the value first being converted to a float. This conversion to and from float is performed by hardware when possible, but on processors that do not natively support half-precision, the conversion is performed through a sequence of lookup table operations.
qfloat16 should be treated as if it were a POD (plain old data) type. Consequently, none of the supported operations need any elaboration beyond stating that it supports all arithmetic operators incident to floating point types.
Definition at line 61 of file qfloat16.h.
| using qfloat16::NativeType = QtPrivate::NativeFloat16Type |
Definition at line 85 of file qfloat16.h.
| using qfloat16::NearestFloat = std::conditional_t<IsNative, NativeType, float> |
Definition at line 88 of file qfloat16.h.
|
inlineexplicitnoexcept |
Constructs a qfloat16 without initializing the value.
Definition at line 90 of file qfloat16.h.
|
inlineconstexprnoexcept |
Definition at line 97 of file qfloat16.h.
|
inlinenoexcept |
Definition at line 417 of file qfloat16.h.
|
inlineexplicitconstexprnoexcept |
Definition at line 102 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 136 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 134 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 139 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 138 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 137 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 135 of file qfloat16.h.
|
inlinestaticconstexprnoexcept |
Definition at line 140 of file qfloat16.h.
\obsolete [6.11] Use the copysign() friend function instead.
Definition at line 110 of file qfloat16.h.
References copysign.
|
noexcept |
Definition at line 165 of file qfloat16.cpp.
References isInf(), and isNaN().
|
inlinenoexcept |
Tests whether this qfloat16 value is finite.
Definition at line 107 of file qfloat16.h.
Referenced by qIsFinite().
|
inlinenoexcept |
Tests whether this qfloat16 value is an infinity.
Definition at line 105 of file qfloat16.h.
Referenced by fpClassify(), and qIsInf().
|
inlinenoexcept |
Tests whether this qfloat16 value is "not a number".
Definition at line 106 of file qfloat16.h.
Referenced by fpClassify(), and qIsNaN().
|
inlineconstexprnoexcept |
Returns true if this qfloat16 value is finite and in normal form.
Definition at line 163 of file qfloat16.h.
|
inlinenoexcept |
Definition at line 457 of file qfloat16.h.
|
inlinenoexcept |
Definition at line 168 of file qfloat16.h.
Referenced by operator++().
|
inlinenoexcept |
Definition at line 166 of file qfloat16.h.
References operator++().
|
inlinenoexcept |
Definition at line 172 of file qfloat16.h.
Referenced by operator--().
|
inlinenoexcept |
Definition at line 170 of file qfloat16.h.
References operator--().
|
friend |
Definition at line 63 of file qfloat16.h.
|
friend |
Definition at line 273 of file qfloat16.h.
|
friend |
Definition at line 297 of file qfloat16.h.
|
friend |
Definition at line 276 of file qfloat16.h.
|
friend |
Definition at line 300 of file qfloat16.h.
Returns a qfloat16 with the sign of sign but the rest of its value taken from {x}. Serves as qfloat16's equivalent of std::copysign().
Definition at line 112 of file qfloat16.h.
Referenced by copySign().
|
friend |
Definition at line 205 of file qfloat16.h.
|
friend |
Definition at line 206 of file qfloat16.h.
|
friend |
|
friend |
|
friend |
Definition at line 452 of file qfloat16.cpp.
|
friend |
Definition at line 483 of file qfloat16.cpp.
|
friend |
Definition at line 469 of file qfloat16.cpp.
|
friend |
Definition at line 475 of file qfloat16.cpp.
Converts len qfloat16 from in to floats and stores them in out. Both in and out must have len allocated entries.
This function is faster than converting values one by one, and will do runtime F16C detection on x86 and x86-64 hardware.
Definition at line 390 of file qfloat16.cpp.
Converts len floats from in to qfloat16 and stores them in out. Both in and out must have len allocated entries.
This function is faster than converting values one by one, and will do runtime F16C detection on x86 and x86-64 hardware.
Definition at line 371 of file qfloat16.cpp.
|
Returns the floating-point class of val.
Compares the floating point value p1 and p2 and returns true if they are considered equal, otherwise false.
The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are.
|
friend |
Definition at line 226 of file qfloat16.h.
|
friend |
Definition at line 408 of file qfloat16.h.
|
Rounds value to the nearest integer.
|
friend |
Returns true if qfloat16 x is negative, false otherwise. Note this function returns true for negative zero, negative infinity, and negative NaN values.
Definition at line 115 of file qfloat16.h.
|
staticconstexpr |
Definition at line 87 of file qfloat16.h.