IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

qfloat16 Class

Provides 16-bit floating point support.

This class was introduced in Qt 5.9.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

qfloat16 Class

  • Header: QFloat16

  • Since: Qt 5.9

  • qmake: QT += core

  • Group: qfloat16 is part of funclists

Detailed Description

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.

Member Function Documentation

 

[since 5.15] qfloat16 qfloat16::copySign(qfloat16 sign) const

Returns a qfloat16 with the sign of sign but the rest of its value taken from this qfloat16. Serves as qfloat16's equivalent of std::copysign().

This function was introduced in Qt 5.15.

[constexpr, since 5.14] bool qfloat16::isNormal() const

Returns true if this qfloat16 value is finite and in normal form.

This function was introduced in Qt 5.14.

See Also

See also qFpClassify()

Related Non-Members

 

[since 5.11] void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len)

Converts len qfloat16 from in to floats and stores them in out. Both in and out must have len allocated entries.

This function was introduced in Qt 5.11.

[since 5.11] void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len)

Converts len floats from in to qfloat16 and stores them in out. Both in and out must have len allocated entries.

This function was introduced in Qt 5.11.

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

See also qIsFinite

bool qIsInf(qfloat16 f)

Returns true if the qfloat16 f is equivalent to infinity.

See Also

See also qIsInf

bool qIsNaN(qfloat16 f)

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

See Also

See also qIsNaN

qint64 qRound64(qfloat16 value)

Rounds value to the nearest 64-bit integer.

See Also

See also qRound64

int qRound(qfloat16 value)

Rounds value to the nearest integer.

See Also

See also qRound

Macro Documentation

 

[since 5.12.4] 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 macro was introduced in Qt 5.12.4.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+