File indexing completed on 2025-01-18 10:07:23
0001
0002
0003
0004
0005 #ifndef QFLOAT16_H
0006 #define QFLOAT16_H
0007
0008 #include <QtCore/qcompare.h>
0009 #include <QtCore/qglobal.h>
0010 #include <QtCore/qhashfunctions.h>
0011 #include <QtCore/qmath.h>
0012 #include <QtCore/qnamespace.h>
0013 #include <QtCore/qtconfigmacros.h>
0014 #include <QtCore/qtypes.h>
0015
0016 #include <limits>
0017 #include <string.h>
0018 #include <type_traits>
0019
0020 #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__)
0021
0022
0023
0024
0025 # if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
0026 # define __F16C__ 1
0027 # endif
0028 #endif
0029
0030 #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
0031 #include <immintrin.h>
0032 #endif
0033
0034 QT_BEGIN_NAMESPACE
0035
0036 #if 0
0037 #pragma qt_class(QFloat16)
0038 #pragma qt_no_master_include
0039 #endif
0040
0041 #ifndef QT_NO_DATASTREAM
0042 class QDataStream;
0043 #endif
0044 class QTextStream;
0045
0046 class qfloat16
0047 {
0048 struct Wrap
0049 {
0050
0051
0052 quint16 b16;
0053 constexpr inline explicit Wrap(int value) : b16(quint16(value)) {}
0054 };
0055
0056 #ifdef QT_SUPPORTS_INT128
0057 template <typename T>
0058 using IsIntegral = std::disjunction<std::is_integral<T>,
0059 std::is_same<std::remove_const_t<T>, qint128>,
0060 std::is_same<std::remove_const_t<T>, quint128>>;
0061 #else
0062 template <typename T>
0063 using IsIntegral = std::is_integral<T>;
0064 #endif
0065 template <typename T>
0066 using if_type_is_integral = std::enable_if_t<IsIntegral<std::remove_reference_t<T>>::value,
0067 bool>;
0068
0069 public:
0070 using NativeType = QtPrivate::NativeFloat16Type;
0071
0072 static constexpr bool IsNative = QFLOAT16_IS_NATIVE;
0073 using NearestFloat = std::conditional_t<IsNative, NativeType, float>;
0074
0075 constexpr inline qfloat16() noexcept : b16(0) {}
0076 explicit qfloat16(Qt::Initialization) noexcept { }
0077
0078 #if QFLOAT16_IS_NATIVE
0079 constexpr inline qfloat16(NativeType f) : nf(f) {}
0080 constexpr operator NativeType() const noexcept { return nf; }
0081 #else
0082 inline qfloat16(float f) noexcept;
0083 inline operator float() const noexcept;
0084 #endif
0085 template <typename T, typename = std::enable_if_t<std::is_arithmetic_v<T> && !std::is_same_v<T, NearestFloat>>>
0086 constexpr explicit qfloat16(T value) noexcept : qfloat16(NearestFloat(value)) {}
0087
0088
0089 bool isInf() const noexcept { return (b16 & 0x7fff) == 0x7c00; }
0090 bool isNaN() const noexcept { return (b16 & 0x7fff) > 0x7c00; }
0091 bool isFinite() const noexcept { return (b16 & 0x7fff) < 0x7c00; }
0092 Q_CORE_EXPORT int fpClassify() const noexcept;
0093
0094 qfloat16 copySign(qfloat16 sign) const noexcept
0095 { return qfloat16(Wrap((sign.b16 & 0x8000) | (b16 & 0x7fff))); }
0096
0097
0098 #ifdef __STDCPP_FLOAT16_T__
0099 private:
0100 using Bounds = std::numeric_limits<NativeType>;
0101 public:
0102 static constexpr qfloat16 _limit_epsilon() noexcept { return Bounds::epsilon(); }
0103 static constexpr qfloat16 _limit_min() noexcept { return Bounds::min(); }
0104 static constexpr qfloat16 _limit_denorm_min() noexcept { return Bounds::denorm_min(); }
0105 static constexpr qfloat16 _limit_max() noexcept { return Bounds::max(); }
0106 static constexpr qfloat16 _limit_lowest() noexcept { return Bounds::lowest(); }
0107 static constexpr qfloat16 _limit_infinity() noexcept { return Bounds::infinity(); }
0108 static constexpr qfloat16 _limit_quiet_NaN() noexcept { return Bounds::quiet_NaN(); }
0109 #if QT_CONFIG(signaling_nan)
0110 static constexpr qfloat16 _limit_signaling_NaN() noexcept { return Bounds::signaling_NaN(); }
0111 #endif
0112 #else
0113 static constexpr qfloat16 _limit_epsilon() noexcept { return qfloat16(Wrap(0x1400)); }
0114 static constexpr qfloat16 _limit_min() noexcept { return qfloat16(Wrap(0x400)); }
0115 static constexpr qfloat16 _limit_denorm_min() noexcept { return qfloat16(Wrap(1)); }
0116 static constexpr qfloat16 _limit_max() noexcept { return qfloat16(Wrap(0x7bff)); }
0117 static constexpr qfloat16 _limit_lowest() noexcept { return qfloat16(Wrap(0xfbff)); }
0118 static constexpr qfloat16 _limit_infinity() noexcept { return qfloat16(Wrap(0x7c00)); }
0119 static constexpr qfloat16 _limit_quiet_NaN() noexcept { return qfloat16(Wrap(0x7e00)); }
0120 #if QT_CONFIG(signaling_nan)
0121 static constexpr qfloat16 _limit_signaling_NaN() noexcept { return qfloat16(Wrap(0x7d00)); }
0122 #endif
0123 #endif
0124 inline constexpr bool isNormal() const noexcept
0125 { return (b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00; }
0126 private:
0127
0128
0129
0130
0131
0132
0133 union {
0134 quint16 b16;
0135 #if QFLOAT16_IS_NATIVE
0136 NativeType nf;
0137 #endif
0138 };
0139 constexpr inline explicit qfloat16(Wrap nibble) noexcept :
0140 #if QFLOAT16_IS_NATIVE && defined(__cpp_lib_bit_cast)
0141 nf(std::bit_cast<NativeType>(nibble.b16))
0142 #else
0143 b16(nibble.b16)
0144 #endif
0145 {}
0146
0147 Q_CORE_EXPORT static const quint32 mantissatable[];
0148 Q_CORE_EXPORT static const quint32 exponenttable[];
0149 Q_CORE_EXPORT static const quint32 offsettable[];
0150 Q_CORE_EXPORT static const quint16 basetable[];
0151 Q_CORE_EXPORT static const quint16 shifttable[];
0152 Q_CORE_EXPORT static const quint32 roundtable[];
0153
0154 friend bool qIsNull(qfloat16 f) noexcept;
0155
0156 friend inline qfloat16 operator-(qfloat16 a) noexcept
0157 {
0158 qfloat16 f;
0159 f.b16 = a.b16 ^ quint16(0x8000);
0160 return f;
0161 }
0162
0163 friend inline qfloat16 operator+(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<NearestFloat>(a) + static_cast<NearestFloat>(b)); }
0164 friend inline qfloat16 operator-(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<NearestFloat>(a) - static_cast<NearestFloat>(b)); }
0165 friend inline qfloat16 operator*(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<NearestFloat>(a) * static_cast<NearestFloat>(b)); }
0166 friend inline qfloat16 operator/(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<NearestFloat>(a) / static_cast<NearestFloat>(b)); }
0167
0168 friend size_t qHash(qfloat16 key, size_t seed = 0) noexcept
0169 { return qHash(float(key), seed); }
0170
0171 QT_WARNING_PUSH
0172 QT_WARNING_DISABLE_GCC("-Wfloat-conversion")
0173
0174 #define QF16_MAKE_ARITH_OP_FP(FP, OP) \
0175 friend inline FP operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \
0176 friend inline FP operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); }
0177 #define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \
0178 friend inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) noexcept \
0179 { lhs = qfloat16(NearestFloat(static_cast<FP>(lhs) OP rhs)); return lhs; }
0180 #define QF16_MAKE_ARITH_OP(FP) \
0181 QF16_MAKE_ARITH_OP_FP(FP, +) \
0182 QF16_MAKE_ARITH_OP_FP(FP, -) \
0183 QF16_MAKE_ARITH_OP_FP(FP, *) \
0184 QF16_MAKE_ARITH_OP_FP(FP, /) \
0185 QF16_MAKE_ARITH_OP_EQ_FP(FP, +=, +) \
0186 QF16_MAKE_ARITH_OP_EQ_FP(FP, -=, -) \
0187 QF16_MAKE_ARITH_OP_EQ_FP(FP, *=, *) \
0188 QF16_MAKE_ARITH_OP_EQ_FP(FP, /=, /)
0189
0190 QF16_MAKE_ARITH_OP(long double)
0191 QF16_MAKE_ARITH_OP(double)
0192 QF16_MAKE_ARITH_OP(float)
0193 #if QFLOAT16_IS_NATIVE
0194 QF16_MAKE_ARITH_OP(NativeType)
0195 #endif
0196 #undef QF16_MAKE_ARITH_OP
0197 #undef QF16_MAKE_ARITH_OP_FP
0198
0199 #define QF16_MAKE_ARITH_OP_INT(OP) \
0200 friend inline double operator OP(qfloat16 lhs, int rhs) noexcept { return static_cast<double>(lhs) OP rhs; } \
0201 friend inline double operator OP(int lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<double>(rhs); }
0202
0203 QF16_MAKE_ARITH_OP_INT(+)
0204 QF16_MAKE_ARITH_OP_INT(-)
0205 QF16_MAKE_ARITH_OP_INT(*)
0206 QF16_MAKE_ARITH_OP_INT(/)
0207 #undef QF16_MAKE_ARITH_OP_INT
0208
0209 QT_WARNING_DISABLE_FLOAT_COMPARE
0210
0211 #if QFLOAT16_IS_NATIVE
0212 # define QF16_CONSTEXPR constexpr
0213 # define QF16_PARTIALLY_ORDERED Q_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE
0214 #else
0215 # define QF16_CONSTEXPR
0216 # define QF16_PARTIALLY_ORDERED Q_DECLARE_PARTIALLY_ORDERED
0217 #endif
0218
0219 friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, const qfloat16 &rhs) noexcept
0220 { return static_cast<NearestFloat>(lhs) == static_cast<NearestFloat>(rhs); }
0221 friend QF16_CONSTEXPR
0222 Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, const qfloat16 &rhs) noexcept
0223 { return Qt::compareThreeWay(static_cast<NearestFloat>(lhs), static_cast<NearestFloat>(rhs)); }
0224 QF16_PARTIALLY_ORDERED(qfloat16)
0225
0226 #define QF16_MAKE_ORDER_OP_FP(FP) \
0227 friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, FP rhs) noexcept \
0228 { return static_cast<FP>(lhs) == rhs; } \
0229 friend QF16_CONSTEXPR \
0230 Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, FP rhs) noexcept \
0231 { return Qt::compareThreeWay(static_cast<FP>(lhs), rhs); } \
0232 QF16_PARTIALLY_ORDERED(qfloat16, FP)
0233
0234 QF16_MAKE_ORDER_OP_FP(long double)
0235 QF16_MAKE_ORDER_OP_FP(double)
0236 QF16_MAKE_ORDER_OP_FP(float)
0237 #if QFLOAT16_IS_NATIVE
0238 QF16_MAKE_ORDER_OP_FP(qfloat16::NativeType)
0239 #endif
0240 #undef QF16_MAKE_ORDER_OP_FP
0241
0242 template <typename T, if_type_is_integral<T> = true>
0243 friend QF16_CONSTEXPR bool comparesEqual(const qfloat16 &lhs, T rhs) noexcept
0244 { return static_cast<NearestFloat>(lhs) == static_cast<NearestFloat>(rhs); }
0245 template <typename T, if_type_is_integral<T> = true>
0246 friend QF16_CONSTEXPR Qt::partial_ordering compareThreeWay(const qfloat16 &lhs, T rhs) noexcept
0247 { return Qt::compareThreeWay(static_cast<NearestFloat>(lhs), static_cast<NearestFloat>(rhs)); }
0248
0249 QF16_PARTIALLY_ORDERED(qfloat16, qint8)
0250 QF16_PARTIALLY_ORDERED(qfloat16, quint8)
0251 QF16_PARTIALLY_ORDERED(qfloat16, qint16)
0252 QF16_PARTIALLY_ORDERED(qfloat16, quint16)
0253 QF16_PARTIALLY_ORDERED(qfloat16, qint32)
0254 QF16_PARTIALLY_ORDERED(qfloat16, quint32)
0255 QF16_PARTIALLY_ORDERED(qfloat16, long)
0256 QF16_PARTIALLY_ORDERED(qfloat16, unsigned long)
0257 QF16_PARTIALLY_ORDERED(qfloat16, qint64)
0258 QF16_PARTIALLY_ORDERED(qfloat16, quint64)
0259 #ifdef QT_SUPPORTS_INT128
0260 QF16_PARTIALLY_ORDERED(qfloat16, qint128)
0261 QF16_PARTIALLY_ORDERED(qfloat16, quint128)
0262 #endif
0263
0264 #undef QF16_PARTIALLY_ORDERED
0265 #undef QF16_CONSTEXPR
0266
0267 QT_WARNING_POP
0268
0269 #ifndef QT_NO_DATASTREAM
0270 friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, qfloat16 f);
0271 friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &ds, qfloat16 &f);
0272 #endif
0273 friend Q_CORE_EXPORT QTextStream &operator<<(QTextStream &ts, qfloat16 f);
0274 friend Q_CORE_EXPORT QTextStream &operator>>(QTextStream &ts, qfloat16 &f);
0275 };
0276
0277 Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
0278
0279 Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) noexcept;
0280 Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept;
0281
0282
0283 [[nodiscard]] inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); }
0284 [[nodiscard]] inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); }
0285 [[nodiscard]] inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); }
0286 [[nodiscard]] inline int qFpClassify(qfloat16 f) noexcept { return f.fpClassify(); }
0287
0288
0289 [[nodiscard]] inline qfloat16 qSqrt(qfloat16 f)
0290 {
0291 #if defined(__cpp_lib_extended_float) && defined(__STDCPP_FLOAT16_T__) && 0
0292
0293 using namespace std;
0294 return sqrt(f);
0295 #elif QFLOAT16_IS_NATIVE && defined(__HAVE_FLOAT16) && __HAVE_FLOAT16
0296
0297 return sqrtf16(f);
0298 #else
0299 bool mathUpdatesErrno = true;
0300 # if defined(__NO_MATH_ERRNO__) || defined(_M_FP_FAST)
0301 mathUpdatesErrno = false;
0302 # elif defined(math_errhandling)
0303 mathUpdatesErrno = (math_errhandling & MATH_ERRNO);
0304 # endif
0305
0306
0307
0308
0309
0310 if (!mathUpdatesErrno || !(0 > f)) {
0311 # if defined(__AVX512FP16__)
0312 __m128h v = _mm_set_sh(f);
0313 v = _mm_sqrt_sh(v, v);
0314 return _mm_cvtsh_h(v);
0315 # endif
0316 }
0317
0318
0319
0320 float f32 = float(f);
0321 f32 = sqrtf(f32);
0322 return qfloat16::NearestFloat(f32);
0323 #endif
0324 }
0325
0326
0327 [[nodiscard]] inline int qRound(qfloat16 d) noexcept
0328 { return qRound(static_cast<float>(d)); }
0329
0330 [[nodiscard]] inline qint64 qRound64(qfloat16 d) noexcept
0331 { return qRound64(static_cast<float>(d)); }
0332
0333 [[nodiscard]] inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
0334 {
0335 qfloat16::NearestFloat f1 = static_cast<qfloat16::NearestFloat>(p1);
0336 qfloat16::NearestFloat f2 = static_cast<qfloat16::NearestFloat>(p2);
0337
0338
0339
0340
0341
0342
0343 return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
0344 }
0345
0346
0347
0348
0349 [[nodiscard]] inline bool qFuzzyIsNull(qfloat16 f) noexcept
0350 {
0351 return qAbs(f) < 0.00976f;
0352 }
0353
0354 [[nodiscard]] inline bool qIsNull(qfloat16 f) noexcept
0355 {
0356 return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
0357 }
0358
0359 inline int qIntCast(qfloat16 f) noexcept
0360 { return int(static_cast<qfloat16::NearestFloat>(f)); }
0361
0362 #if !defined(Q_QDOC) && !QFLOAT16_IS_NATIVE
0363 QT_WARNING_PUSH
0364 QT_WARNING_DISABLE_CLANG("-Wc99-extensions")
0365 QT_WARNING_DISABLE_GCC("-Wold-style-cast")
0366 inline qfloat16::qfloat16(float f) noexcept
0367 {
0368 #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
0369 __m128 packsingle = _mm_set_ss(f);
0370 __m128i packhalf = _mm_cvtps_ph(packsingle, 0);
0371 b16 = _mm_extract_epi16(packhalf, 0);
0372 #elif defined (__ARM_FP16_FORMAT_IEEE)
0373 __fp16 f16 = __fp16(f);
0374 memcpy(&b16, &f16, sizeof(quint16));
0375 #else
0376 quint32 u;
0377 memcpy(&u, &f, sizeof(quint32));
0378 const quint32 signAndExp = u >> 23;
0379 const quint16 base = basetable[signAndExp];
0380 const quint16 shift = shifttable[signAndExp];
0381 const quint32 round = roundtable[signAndExp];
0382 quint32 mantissa = (u & 0x007fffff);
0383 if ((signAndExp & 0xff) == 0xff) {
0384 if (mantissa)
0385 mantissa = qMax(1U << shift, mantissa);
0386 } else {
0387
0388
0389 mantissa += round;
0390
0391
0392
0393 if (mantissa & (1 << shift))
0394 --mantissa;
0395 }
0396
0397
0398
0399 b16 = quint16(base + (mantissa >> shift));
0400 #endif
0401 }
0402 QT_WARNING_POP
0403
0404 inline qfloat16::operator float() const noexcept
0405 {
0406 #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)
0407 __m128i packhalf = _mm_cvtsi32_si128(b16);
0408 __m128 packsingle = _mm_cvtph_ps(packhalf);
0409 return _mm_cvtss_f32(packsingle);
0410 #elif defined (__ARM_FP16_FORMAT_IEEE)
0411 __fp16 f16;
0412 memcpy(&f16, &b16, sizeof(quint16));
0413 return float(f16);
0414 #else
0415 quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)]
0416 + exponenttable[b16 >> 10];
0417 float f;
0418 memcpy(&f, &u, sizeof(quint32));
0419 return f;
0420 #endif
0421 }
0422 #endif
0423
0424
0425
0426
0427 namespace QtPrivate {
0428 template <> struct QHypotType<qfloat16, qfloat16>
0429 {
0430 using type = qfloat16;
0431 };
0432 template <typename R> struct QHypotType<R, qfloat16>
0433 {
0434 using type = std::conditional_t<std::is_floating_point_v<R>, R, double>;
0435 };
0436 template <typename R> struct QHypotType<qfloat16, R> : QHypotType<R, qfloat16>
0437 {
0438 };
0439 }
0440
0441
0442
0443 inline auto qHypot(qfloat16 x, qfloat16 y)
0444 {
0445 #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) || QFLOAT16_IS_NATIVE
0446 return QtPrivate::QHypotHelper<qfloat16>(x).add(y).result();
0447 #else
0448 return qfloat16(qHypot(float(x), float(y)));
0449 #endif
0450 }
0451
0452
0453 template<typename F, typename ...Fs> auto qHypot(F first, Fs... rest);
0454
0455 template <typename T> typename QtPrivate::QHypotType<T, qfloat16>::type
0456 qHypot(T x, qfloat16 y)
0457 {
0458 if constexpr (std::is_floating_point_v<T>)
0459 return qHypot(x, float(y));
0460 else
0461 return qHypot(qfloat16(x), y);
0462 }
0463 template <typename T> auto qHypot(qfloat16 x, T y)
0464 {
0465 return qHypot(y, x);
0466 }
0467
0468 #if defined(__cpp_lib_hypot) && __cpp_lib_hypot >= 201603L
0469
0470
0471
0472
0473 template <typename Ty, typename Tz,
0474 typename std::enable_if<
0475
0476 !(std::is_same_v<qfloat16, Ty> && std::is_same_v<qfloat16, Tz>), int>::type = 0>
0477 auto qHypot(qfloat16 x, Ty y, Tz z) { return qHypot(qfloat16::NearestFloat(x), y, z); }
0478 template <typename Tx, typename Tz,
0479 typename std::enable_if<
0480
0481 !std::is_same_v<qfloat16, Tx>, int>::type = 0>
0482 auto qHypot(Tx x, qfloat16 y, Tz z) { return qHypot(x, qfloat16::NearestFloat(y), z); }
0483 template <typename Tx, typename Ty,
0484 typename std::enable_if<
0485
0486 !std::is_same_v<qfloat16, Tx> && !std::is_same_v<qfloat16, Ty>, int>::type = 0>
0487 auto qHypot(Tx x, Ty y, qfloat16 z) { return qHypot(x, y, qfloat16::NearestFloat(z)); }
0488
0489
0490 inline auto qHypot(qfloat16 x, qfloat16 y, qfloat16 z)
0491 {
0492 #if (defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__)) || QFLOAT16_IS_NATIVE
0493 return QtPrivate::QHypotHelper<qfloat16>(x).add(y).add(z).result();
0494 #else
0495 return qfloat16(qHypot(float(x), float(y), float(z)));
0496 #endif
0497 }
0498 #endif
0499
0500 QT_END_NAMESPACE
0501
0502 namespace std {
0503 template<>
0504 class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float>
0505 {
0506 public:
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517 static constexpr int digits = 11;
0518 static constexpr int min_exponent = -13;
0519 static constexpr int max_exponent = 16;
0520
0521 static constexpr int digits10 = 3;
0522 static constexpr int max_digits10 = 5;
0523 static constexpr int min_exponent10 = -4;
0524 static constexpr int max_exponent10 = 4;
0525
0526 static constexpr QT_PREPEND_NAMESPACE(qfloat16) epsilon()
0527 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_epsilon(); }
0528 static constexpr QT_PREPEND_NAMESPACE(qfloat16) (min)()
0529 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_min(); }
0530 static constexpr QT_PREPEND_NAMESPACE(qfloat16) denorm_min()
0531 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_denorm_min(); }
0532 static constexpr QT_PREPEND_NAMESPACE(qfloat16) (max)()
0533 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_max(); }
0534 static constexpr QT_PREPEND_NAMESPACE(qfloat16) lowest()
0535 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_lowest(); }
0536 static constexpr QT_PREPEND_NAMESPACE(qfloat16) infinity()
0537 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_infinity(); }
0538 static constexpr QT_PREPEND_NAMESPACE(qfloat16) quiet_NaN()
0539 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_quiet_NaN(); }
0540 #if QT_CONFIG(signaling_nan)
0541 static constexpr QT_PREPEND_NAMESPACE(qfloat16) signaling_NaN()
0542 { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_signaling_NaN(); }
0543 #else
0544 static constexpr bool has_signaling_NaN = false;
0545 #endif
0546 };
0547
0548 template<> class numeric_limits<const QT_PREPEND_NAMESPACE(qfloat16)>
0549 : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
0550 template<> class numeric_limits<volatile QT_PREPEND_NAMESPACE(qfloat16)>
0551 : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
0552 template<> class numeric_limits<const volatile QT_PREPEND_NAMESPACE(qfloat16)>
0553 : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {};
0554
0555
0556
0557 }
0558
0559 #endif