<QFloat16> - 16-bit Floating Point Support

The <QFloat16> header file provides 16-bit floating point support. More...

This documentation was introduced in Qt 5.9.

Functions

bool qFuzzyCompare(qfloat16 p1, qfloat16 p2)
bool qIsFinite(qfloat16 f)
bool qIsInf(qfloat16 f)
bool qIsNaN(qfloat16 f)
qint64 qRound64(qfloat16 value)
int qRound(qfloat16 value)

This header file provides support for half-precision (16-bit) floating point data with the class qfloat16. 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.

Function Documentation

bool qFuzzyCompare(qfloat16 p1, qfloat16 p2)

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.

bool qIsFinite(qfloat16 f)

Returns true if the qfloat16 f is a finite number.

See also qIsFinite.

bool qIsInf(qfloat16 f)

Returns true if the qfloat16 f is equivalent to infinity.

See also qIsInf.

bool qIsNaN(qfloat16 f)

Returns true if the qfloat16 f is not a number (NaN).

See also qIsNaN.

qint64 qRound64(qfloat16 value)

Rounds value to the nearest 64-bit integer.

See also qRound64.

int qRound(qfloat16 value)

Rounds value to the nearest integer.

See also qRound.

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.