提供 16 位浮点支持。
qfloat16class 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 aqfloat16instance results in the value first being converted to afloat. This conversion to and fromfloatis 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.
qfloat16should 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.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]).Returns a qfloat16 with the sign of
signbut the rest of its value taken from this qfloat16. Serves as qfloat16’s equivalent of std::copysign().实现
qFpClassify()for qfloat16.另请参阅
qFpClassify()返回
true若此qfloat16值是有限的且采用正常形式。另请参阅
qFpClassify()转换
lenqfloat16 frominto floats and stores them inout. Bothinandoutmust havelenallocated entries.转换
lenfloats frominto qfloat16 and stores them inout. Bothinandoutmust havelenallocated entries.比较浮点值
p1andp2并返回true若它们被认为相等,否则false.The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are.
返回 true 若
qfloat16f是有限数。另请参阅
qIsFinite返回 true 若
qfloat16f相当于无穷大。另请参阅
qIsInf返回 true 若
qfloat16f是 NaN (非数字)。另请参阅
qIsNaN圆整
value到最近整数。另请参阅
qRound圆整
value到最近 64 位整数。另请参阅
qRound64