qfloat16 Class
Provides 16-bit floating point support. More...
| Header: | #include <QFloat16> |
| qmake: | QT += core |
| Since: | Qt 5.9 |
Macros
Detailed Description
Provides 16-bit floating point support.
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.
Note: On x86 and x86-64 that to get hardware accelerated conversions you must compile with F16C or AVX2 enabled, or use qFloatToFloat16() and qFloatFromFloat16() which will detect F16C at runtime.
Macro Documentation
QT_NO_FLOAT16_OPERATORS
Defining this macro disables the arithmetic operators for qfloat16.
This is only necessary on Visual Studio 2017 (and earlier) when including <QFloat16> and <bitset> in the same translation unit, which would otherwise cause a compilation error due to a toolchain bug (see [QTBUG-72073]).
This function was introduced in Qt 5.12.4.