diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -153,10 +153,13 @@ S_BFloat, S_IEEEsingle, S_IEEEdouble, - S_x87DoubleExtended, S_IEEEquad, S_PPCDoubleDouble, - S_MaxSemantics = S_PPCDoubleDouble + // 8-bit floating point number following IEEE-754 conventions with bit + // layout S1E5M2. + S_F8M2, + S_x87DoubleExtended, + S_MaxSemantics = S_x87DoubleExtended, }; static const llvm::fltSemantics &EnumToSemantics(Semantics S); @@ -168,6 +171,7 @@ static const fltSemantics &IEEEdouble() LLVM_READNONE; static const fltSemantics &IEEEquad() LLVM_READNONE; static const fltSemantics &PPCDoubleDouble() LLVM_READNONE; + static const fltSemantics &F8M2() LLVM_READNONE; static const fltSemantics &x87DoubleExtended() LLVM_READNONE; /// A Pseudo fltsemantic used to construct APFloats that cannot conflict with @@ -552,6 +556,7 @@ APInt convertQuadrupleAPFloatToAPInt() const; APInt convertF80LongDoubleAPFloatToAPInt() const; APInt convertPPCDoubleDoubleAPFloatToAPInt() const; + APInt convertF8M2APFloatToAPInt() const; void initFromAPInt(const fltSemantics *Sem, const APInt &api); void initFromHalfAPInt(const APInt &api); void initFromBFloatAPInt(const APInt &api); @@ -560,6 +565,7 @@ void initFromQuadrupleAPInt(const APInt &api); void initFromF80LongDoubleAPInt(const APInt &api); void initFromPPCDoubleDoubleAPInt(const APInt &api); + void initFromF8M2APInt(const APInt &api); void assign(const IEEEFloat &); void copySignificand(const IEEEFloat &); diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -80,6 +80,7 @@ static const fltSemantics semIEEEsingle = {127, -126, 24, 32}; static const fltSemantics semIEEEdouble = {1023, -1022, 53, 64}; static const fltSemantics semIEEEquad = {16383, -16382, 113, 128}; + static const fltSemantics semF8M2 = {15, -14, 3, 8}; static const fltSemantics semX87DoubleExtended = {16383, -16382, 64, 80}; static const fltSemantics semBogus = {0, 0, 0, 0}; @@ -131,12 +132,14 @@ return IEEEsingle(); case S_IEEEdouble: return IEEEdouble(); - case S_x87DoubleExtended: - return x87DoubleExtended(); case S_IEEEquad: return IEEEquad(); case S_PPCDoubleDouble: return PPCDoubleDouble(); + case S_F8M2: + return F8M2(); + case S_x87DoubleExtended: + return x87DoubleExtended(); } llvm_unreachable("Unrecognised floating semantics"); } @@ -151,12 +154,14 @@ return S_IEEEsingle; else if (&Sem == &llvm::APFloat::IEEEdouble()) return S_IEEEdouble; - else if (&Sem == &llvm::APFloat::x87DoubleExtended()) - return S_x87DoubleExtended; else if (&Sem == &llvm::APFloat::IEEEquad()) return S_IEEEquad; else if (&Sem == &llvm::APFloat::PPCDoubleDouble()) return S_PPCDoubleDouble; + else if (&Sem == &llvm::APFloat::F8M2()) + return S_F8M2; + else if (&Sem == &llvm::APFloat::x87DoubleExtended()) + return S_x87DoubleExtended; else llvm_unreachable("Unknown floating semantics"); } @@ -173,18 +178,15 @@ const fltSemantics &APFloatBase::IEEEdouble() { return semIEEEdouble; } - const fltSemantics &APFloatBase::IEEEquad() { - return semIEEEquad; + const fltSemantics &APFloatBase::IEEEquad() { return semIEEEquad; } + const fltSemantics &APFloatBase::PPCDoubleDouble() { + return semPPCDoubleDouble; } + const fltSemantics &APFloatBase::F8M2() { return semF8M2; } const fltSemantics &APFloatBase::x87DoubleExtended() { return semX87DoubleExtended; } - const fltSemantics &APFloatBase::Bogus() { - return semBogus; - } - const fltSemantics &APFloatBase::PPCDoubleDouble() { - return semPPCDoubleDouble; - } + const fltSemantics &APFloatBase::Bogus() { return semBogus; } constexpr RoundingMode APFloatBase::rmNearestTiesToEven; constexpr RoundingMode APFloatBase::rmTowardPositive; @@ -3353,6 +3355,33 @@ (mysignificand & 0x3ff))); } +APInt IEEEFloat::convertF8M2APFloatToAPInt() const { + assert(semantics == (const llvm::fltSemantics *)&semF8M2); + assert(partCount() == 1); + + uint32_t myexponent, mysignificand; + + if (isFiniteNonZero()) { + myexponent = exponent + 15; // bias + mysignificand = (uint32_t)*significandParts(); + if (myexponent == 1 && !(mysignificand & 0x4)) + myexponent = 0; // denormal + } else if (category == fcZero) { + myexponent = 0; + mysignificand = 0; + } else if (category == fcInfinity) { + myexponent = 0x1f; + mysignificand = 0; + } else { + assert(category == fcNaN && "Unknown category!"); + myexponent = 0x1f; + mysignificand = (uint32_t)*significandParts(); + } + + return APInt(8, (((sign & 1) << 7) | ((myexponent & 0x1f) << 2) | + (mysignificand & 0x3))); +} + // This function creates an APInt that is just a bit map of the floating // point constant as it would appear in memory. It is not a conversion, // and treating the result as a normal integer is unlikely to be useful. @@ -3376,6 +3405,9 @@ if (semantics == (const llvm::fltSemantics *)&semPPCDoubleDoubleLegacy) return convertPPCDoubleDoubleAPFloatToAPInt(); + if (semantics == (const llvm::fltSemantics *)&semF8M2) + return convertF8M2APFloatToAPInt(); + assert(semantics == (const llvm::fltSemantics*)&semX87DoubleExtended && "unknown format!"); return convertF80LongDoubleAPFloatToAPInt(); @@ -3603,6 +3635,34 @@ } } +void IEEEFloat::initFromF8M2APInt(const APInt &api) { + uint32_t i = (uint32_t)*api.getRawData(); + uint32_t myexponent = (i >> 2) & 0x1f; + uint32_t mysignificand = i & 0x3; + + initialize(&semF8M2); + assert(partCount() == 1); + + sign = i >> 7; + if (myexponent == 0 && mysignificand == 0) { + makeZero(sign); + } else if (myexponent == 0x1f && mysignificand == 0) { + makeInf(sign); + } else if (myexponent == 0x1f && mysignificand != 0) { + category = fcNaN; + exponent = exponentNaN(); + *significandParts() = mysignificand; + } else { + category = fcNormal; + exponent = myexponent - 15; // bias + *significandParts() = mysignificand; + if (myexponent == 0) // denormal + exponent = -14; + else + *significandParts() |= 0x4; // integer bit + } +} + /// Treat api as containing the bits of a floating point number. Currently /// we infer the floating point type from the size of the APInt. The /// isIEEE argument distinguishes between PPC128 and IEEE128 (not meaningful @@ -3623,6 +3683,8 @@ return initFromQuadrupleAPInt(api); if (Sem == &semPPCDoubleDoubleLegacy) return initFromPPCDoubleDoubleAPInt(api); + if (Sem == &semF8M2) + return initFromF8M2APInt(api); llvm_unreachable(nullptr); } diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp --- a/llvm/unittests/ADT/APFloatTest.cpp +++ b/llvm/unittests/ADT/APFloatTest.cpp @@ -1,4 +1,5 @@ -//===- llvm/unittest/ADT/APFloat.cpp - APFloat unit tests ---------------------===// +//===- llvm/unittest/ADT/APFloat.cpp - APFloat unit tests +//---------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -54,12 +55,16 @@ APInt payload = APInt::getOneBitSet(4, 2); EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), false).isSignaling()); EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), true).isSignaling()); - EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), false, &payload).isSignaling()); - EXPECT_FALSE(APFloat::getQNaN(APFloat::IEEEsingle(), true, &payload).isSignaling()); + EXPECT_FALSE( + APFloat::getQNaN(APFloat::IEEEsingle(), false, &payload).isSignaling()); + EXPECT_FALSE( + APFloat::getQNaN(APFloat::IEEEsingle(), true, &payload).isSignaling()); EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isSignaling()); EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), true).isSignaling()); - EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), false, &payload).isSignaling()); - EXPECT_TRUE(APFloat::getSNaN(APFloat::IEEEsingle(), true, &payload).isSignaling()); + EXPECT_TRUE( + APFloat::getSNaN(APFloat::IEEEsingle(), false, &payload).isSignaling()); + EXPECT_TRUE( + APFloat::getSNaN(APFloat::IEEEsingle(), true, &payload).isSignaling()); } TEST(APFloatTest, next) { @@ -122,16 +127,16 @@ // = -(-getLargest() + inc) // = getLargest() - inc. test = APFloat::getLargest(APFloat::IEEEquad(), false); - expected = APFloat(APFloat::IEEEquad(), - "0x1.fffffffffffffffffffffffffffep+16383"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.fffffffffffffffffffffffffffep+16383"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(!test.isInfinity() && !test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(-getLargest()) = -getLargest() + inc. test = APFloat::getLargest(APFloat::IEEEquad(), true); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.fffffffffffffffffffffffffffep+16383"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.fffffffffffffffffffffffffffep+16383"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); @@ -143,30 +148,34 @@ EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(getSmallest()) = getSmallest() + inc. - test = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x0.0000000000000000000000000002p-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000002p-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(getSmallest()) = -nextUp(-getSmallest()) = -(-0) = +0. - test = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); expected = APFloat::getZero(APFloat::IEEEquad(), false); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.isPosZero()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(-getSmallest()) = -0. - test = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); expected = APFloat::getZero(APFloat::IEEEquad(), true); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.isNegZero()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-getSmallest()) = -nextUp(getSmallest()) = -getSmallest() - inc. - test = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x0.0000000000000000000000000002p-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000002p-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); @@ -227,36 +236,37 @@ // * nextDown(+Smallest Normal) -> +Largest Denormal. // nextUp(+Largest Denormal) -> +Smallest Normal. - test = APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x1.0000000000000000000000000000p-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.0000000000000000000000000000p-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_FALSE(test.isDenormal()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-Largest Denormal) -> -Smallest Normal. - test = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffffffffp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.0000000000000000000000000000p-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000000p-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_FALSE(test.isDenormal()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(-Smallest Normal) -> -LargestDenormal. - test = APFloat(APFloat::IEEEquad(), - "-0x1.0000000000000000000000000000p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffffffffp-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000000p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffffffffp-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(+Smallest Normal) -> +Largest Denormal. - test = APFloat(APFloat::IEEEquad(), - "+0x1.0000000000000000000000000000p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "+0x0.ffffffffffffffffffffffffffffp-16382"); + test = + APFloat(APFloat::IEEEquad(), "+0x1.0000000000000000000000000000p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "+0x0.ffffffffffffffffffffffffffffp-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); @@ -269,14 +279,15 @@ // nextUp(-Normal Binade Boundary) -> -Normal Binade Boundary + 1. test = APFloat(APFloat::IEEEquad(), "-0x1p+1"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffffffffp+0"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp+0"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(+Normal Binade Boundary) -> +Normal Binade Boundary - 1. test = APFloat(APFloat::IEEEquad(), "0x1p+1"); - expected = APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp+0"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp+0"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); @@ -304,36 +315,40 @@ // * nextDown(-Smallest Normal) -> -Smallest Normal - inc. // nextUp(-Largest Denormal) -> -Largest Denormal + inc. - test = APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffffffffp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x0.fffffffffffffffffffffffffffep-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.fffffffffffffffffffffffffffep-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(+Largest Denormal) -> +Largest Denormal - inc. - test = APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x0.fffffffffffffffffffffffffffep-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x0.fffffffffffffffffffffffffffep-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(+Smallest Normal) -> +Smallest Normal + inc. - test = APFloat(APFloat::IEEEquad(), "0x1.0000000000000000000000000000p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x1.0000000000000000000000000001p-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x1.0000000000000000000000000000p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.0000000000000000000000000001p-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-Smallest Normal) -> -Smallest Normal - inc. - test = APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000000p-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.0000000000000000000000000001p-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000000p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.0000000000000000000000000001p-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(test.isNegative()); @@ -350,28 +365,30 @@ // nextUp(-0x1p-16381) -> -0x1.ffffffffffffffffffffffffffffp-16382 test = APFloat(APFloat::IEEEquad(), "-0x1p-16381"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-0x1.ffffffffffffffffffffffffffffp-16382) -> // -0x1p-16381 - test = APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffffffffp-16382"); expected = APFloat(APFloat::IEEEquad(), "-0x1p-16381"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(0x1.ffffffffffffffffffffffffffffp-16382) -> 0x1p-16381 - test = APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp-16382"); expected = APFloat(APFloat::IEEEquad(), "0x1p-16381"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(0x1p-16381) -> 0x1.ffffffffffffffffffffffffffffp-16382 test = APFloat(APFloat::IEEEquad(), "0x1p-16381"); - expected = APFloat(APFloat::IEEEquad(), - "0x1.ffffffffffffffffffffffffffffp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffffffffp-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.bitwiseIsEqual(expected)); @@ -387,80 +404,80 @@ // * nextDown(-Normal) -> -Normal. // nextUp(+Denormal) -> +Denormal. - test = APFloat(APFloat::IEEEquad(), - "0x0.ffffffffffffffffffffffff000cp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x0.ffffffffffffffffffffffff000dp-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffff000cp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffff000dp-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(+Denormal) -> +Denormal. - test = APFloat(APFloat::IEEEquad(), - "0x0.ffffffffffffffffffffffff000cp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "0x0.ffffffffffffffffffffffff000bp-16382"); + test = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffff000cp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x0.ffffffffffffffffffffffff000bp-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(-Denormal) -> -Denormal. - test = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffff000cp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffff000bp-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffff000cp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffff000bp-16382"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-Denormal) -> -Denormal - test = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffff000cp-16382"); - expected = APFloat(APFloat::IEEEquad(), - "-0x0.ffffffffffffffffffffffff000dp-16382"); + test = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffff000cp-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.ffffffffffffffffffffffff000dp-16382"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(+Normal) -> +Normal. - test = APFloat(APFloat::IEEEquad(), - "0x1.ffffffffffffffffffffffff000cp-16000"); - expected = APFloat(APFloat::IEEEquad(), - "0x1.ffffffffffffffffffffffff000dp-16000"); + test = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffff000cp-16000"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffff000dp-16000"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(+Normal) -> +Normal. - test = APFloat(APFloat::IEEEquad(), - "0x1.ffffffffffffffffffffffff000cp-16000"); - expected = APFloat(APFloat::IEEEquad(), - "0x1.ffffffffffffffffffffffff000bp-16000"); + test = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffff000cp-16000"); + expected = + APFloat(APFloat::IEEEquad(), "0x1.ffffffffffffffffffffffff000bp-16000"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(!test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextUp(-Normal) -> -Normal. - test = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffff000cp-16000"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffff000bp-16000"); + test = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffff000cp-16000"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffff000bp-16000"); EXPECT_EQ(test.next(false), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(test.isNegative()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); // nextDown(-Normal) -> -Normal. - test = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffff000cp-16000"); - expected = APFloat(APFloat::IEEEquad(), - "-0x1.ffffffffffffffffffffffff000dp-16000"); + test = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffff000cp-16000"); + expected = + APFloat(APFloat::IEEEquad(), "-0x1.ffffffffffffffffffffffff000dp-16000"); EXPECT_EQ(test.next(true), APFloat::opOK); EXPECT_TRUE(!test.isDenormal()); EXPECT_TRUE(test.isNegative()); @@ -522,7 +539,7 @@ // Test -ve sign preservation when small negative results underflow. { - APFloat f1(APFloat::IEEEdouble(), "-0x1p-1074"); + APFloat f1(APFloat::IEEEdouble(), "-0x1p-1074"); APFloat f2(APFloat::IEEEdouble(), "+0x1p-1074"); APFloat f3(0.0); f1.fusedMultiplyAdd(f2, f3, APFloat::rmNearestTiesToEven); @@ -642,7 +659,8 @@ // Test Intel double-ext { const char *MinNormalStr = "3.36210314311209350626e-4932"; - EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended(), MinNormalStr).isDenormal()); + EXPECT_FALSE( + APFloat(APFloat::x87DoubleExtended(), MinNormalStr).isDenormal()); EXPECT_FALSE(APFloat(APFloat::x87DoubleExtended(), 0).isDenormal()); APFloat Val2(APFloat::x87DoubleExtended(), 2); @@ -665,11 +683,11 @@ } TEST(APFloatTest, Zero) { - EXPECT_EQ(0.0f, APFloat(0.0f).convertToFloat()); + EXPECT_EQ(0.0f, APFloat(0.0f).convertToFloat()); EXPECT_EQ(-0.0f, APFloat(-0.0f).convertToFloat()); EXPECT_TRUE(APFloat(-0.0f).isNegative()); - EXPECT_EQ(0.0, APFloat(0.0).convertToDouble()); + EXPECT_EQ(0.0, APFloat(0.0).convertToDouble()); EXPECT_EQ(-0.0, APFloat(-0.0).convertToDouble()); EXPECT_TRUE(APFloat(-0.0).isNegative()); } @@ -686,228 +704,255 @@ } TEST(APFloatTest, fromZeroDecimalString) { - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".0").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.0").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "00000.").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "00000.").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+00000.").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-00000.").convertToDouble()); - EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".00000").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".00000").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.00000").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.00000").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0000.00000").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0000.00000").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0000.00000").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0000.00000").convertToDouble()); + EXPECT_EQ(+0.0, + APFloat(APFloat::IEEEdouble(), "+0000.00000").convertToDouble()); + EXPECT_EQ(-0.0, + APFloat(APFloat::IEEEdouble(), "-0000.00000").convertToDouble()); } TEST(APFloatTest, fromZeroDecimalSingleExponentString) { - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e1").convertToDouble()); + EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e1").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.e1").convertToDouble()); + EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e1").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.e+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.e-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.e-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.e-1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".0e1").convertToDouble()); + EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e1").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".0e+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), ".0e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), ".0e-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+.0e-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-.0e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.0e1").convertToDouble()); + EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e1").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.0e+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0.0e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0.0e-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0.0e-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0.0e-1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "000.0000e1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+000.0000e+1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-000.0000e+1").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "000.0000e1").convertToDouble()); + EXPECT_EQ(+0.0, + APFloat(APFloat::IEEEdouble(), "+000.0000e+1").convertToDouble()); + EXPECT_EQ(-0.0, + APFloat(APFloat::IEEEdouble(), "-000.0000e+1").convertToDouble()); } TEST(APFloatTest, fromZeroDecimalLargeExponentString) { - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e1234").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e1234").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e+1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e+1234").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e+1234").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e+1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0e-1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0e-1234").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0e-1234").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0e-1234").convertToDouble()); - EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "000.0000e1234").convertToDouble()); - EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "000.0000e-1234").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "000.0000e1234").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "000.0000e-1234").convertToDouble()); - EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), StringRef("0e1234" "\0" "2", 6)).convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), StringRef("0e1234" + "\0" + "2", + 6)) + .convertToDouble()); } TEST(APFloatTest, fromZeroHexadecimalString) { - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0p1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0p+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0p-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0p-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p-1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.p+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.p-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.p-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.p-1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x.0p1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x.0p+1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p+1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p+1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.0p-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x.0p-1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x.0p-1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x.0p-1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p1").convertToDouble()); EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p1").convertToDouble()); EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p+1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p+1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p+1").convertToDouble()); - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p-1").convertToDouble()); - EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble(), "+0x0.0p-1").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0.0p-1").convertToDouble()); - - - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x00000.p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0000.00000p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.00000p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0p1234").convertToDouble()); - EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble(), "-0x0p1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x00000.p1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0000.00000p1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x.00000p1234").convertToDouble()); - EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p+1").convertToDouble()); + EXPECT_EQ(+0.0, + APFloat(APFloat::IEEEdouble(), "+0x0.0p+1").convertToDouble()); + EXPECT_EQ(-0.0, + APFloat(APFloat::IEEEdouble(), "-0x0.0p+1").convertToDouble()); + + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.0p-1").convertToDouble()); + EXPECT_EQ(+0.0, + APFloat(APFloat::IEEEdouble(), "+0x0.0p-1").convertToDouble()); + EXPECT_EQ(-0.0, + APFloat(APFloat::IEEEdouble(), "-0x0.0p-1").convertToDouble()); + + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0x00000.p1").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0x0000.00000p1").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0x.00000p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0p1234").convertToDouble()); + EXPECT_EQ(-0.0, + APFloat(APFloat::IEEEdouble(), "-0x0p1234").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0x00000.p1234").convertToDouble()); + EXPECT_EQ( + 0.0, + APFloat(APFloat::IEEEdouble(), "0x0000.00000p1234").convertToDouble()); + EXPECT_EQ(0.0, + APFloat(APFloat::IEEEdouble(), "0x.00000p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble(), "0x0.p1234").convertToDouble()); } TEST(APFloatTest, fromDecimalString) { - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1").convertToDouble()); - EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble()); - EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble(), ".5").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0").convertToDouble()); - EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-2").convertToDouble()); - EXPECT_EQ(-4.0, APFloat(APFloat::IEEEdouble(), "-4.").convertToDouble()); - EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble(), "-.5").convertToDouble()); - EXPECT_EQ(-1.5, APFloat(APFloat::IEEEdouble(), "-1.5").convertToDouble()); - EXPECT_EQ(1.25e12, APFloat(APFloat::IEEEdouble(), "1.25e12").convertToDouble()); - EXPECT_EQ(1.25e+12, APFloat(APFloat::IEEEdouble(), "1.25e+12").convertToDouble()); - EXPECT_EQ(1.25e-12, APFloat(APFloat::IEEEdouble(), "1.25e-12").convertToDouble()); - EXPECT_EQ(1024.0, APFloat(APFloat::IEEEdouble(), "1024.").convertToDouble()); - EXPECT_EQ(1024.05, APFloat(APFloat::IEEEdouble(), "1024.05000").convertToDouble()); - EXPECT_EQ(0.05, APFloat(APFloat::IEEEdouble(), ".05000").convertToDouble()); - EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble()); - EXPECT_EQ(2.0e2, APFloat(APFloat::IEEEdouble(), "2.e2").convertToDouble()); - EXPECT_EQ(2.0e+2, APFloat(APFloat::IEEEdouble(), "2.e+2").convertToDouble()); - EXPECT_EQ(2.0e-2, APFloat(APFloat::IEEEdouble(), "2.e-2").convertToDouble()); - EXPECT_EQ(2.05e2, APFloat(APFloat::IEEEdouble(), "002.05000e2").convertToDouble()); - EXPECT_EQ(2.05e+2, APFloat(APFloat::IEEEdouble(), "002.05000e+2").convertToDouble()); - EXPECT_EQ(2.05e-2, APFloat(APFloat::IEEEdouble(), "002.05000e-2").convertToDouble()); - EXPECT_EQ(2.05e12, APFloat(APFloat::IEEEdouble(), "002.05000e12").convertToDouble()); - EXPECT_EQ(2.05e+12, APFloat(APFloat::IEEEdouble(), "002.05000e+12").convertToDouble()); - EXPECT_EQ(2.05e-12, APFloat(APFloat::IEEEdouble(), "002.05000e-12").convertToDouble()); - - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "+1e").convertToDouble()); - EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-1e").convertToDouble()); - - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.e").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "+1.e").convertToDouble()); - EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-1.e").convertToDouble()); - - EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble()); - EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), "+.1e").convertToDouble()); - EXPECT_EQ(-0.1, APFloat(APFloat::IEEEdouble(), "-.1e").convertToDouble()); - - EXPECT_EQ(1.1, APFloat(APFloat::IEEEdouble(), "1.1e").convertToDouble()); - EXPECT_EQ(1.1, APFloat(APFloat::IEEEdouble(), "+1.1e").convertToDouble()); - EXPECT_EQ(-1.1, APFloat(APFloat::IEEEdouble(), "-1.1e").convertToDouble()); - - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e+").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e-").convertToDouble()); - - EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble()); - EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e+").convertToDouble()); - EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e-").convertToDouble()); - - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e+").convertToDouble()); - EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e-").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1").convertToDouble()); + EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble()); + EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble(), ".5").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0").convertToDouble()); + EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-2").convertToDouble()); + EXPECT_EQ(-4.0, APFloat(APFloat::IEEEdouble(), "-4.").convertToDouble()); + EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble(), "-.5").convertToDouble()); + EXPECT_EQ(-1.5, APFloat(APFloat::IEEEdouble(), "-1.5").convertToDouble()); + EXPECT_EQ(1.25e12, + APFloat(APFloat::IEEEdouble(), "1.25e12").convertToDouble()); + EXPECT_EQ(1.25e+12, + APFloat(APFloat::IEEEdouble(), "1.25e+12").convertToDouble()); + EXPECT_EQ(1.25e-12, + APFloat(APFloat::IEEEdouble(), "1.25e-12").convertToDouble()); + EXPECT_EQ(1024.0, APFloat(APFloat::IEEEdouble(), "1024.").convertToDouble()); + EXPECT_EQ(1024.05, + APFloat(APFloat::IEEEdouble(), "1024.05000").convertToDouble()); + EXPECT_EQ(0.05, APFloat(APFloat::IEEEdouble(), ".05000").convertToDouble()); + EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "2.").convertToDouble()); + EXPECT_EQ(2.0e2, APFloat(APFloat::IEEEdouble(), "2.e2").convertToDouble()); + EXPECT_EQ(2.0e+2, APFloat(APFloat::IEEEdouble(), "2.e+2").convertToDouble()); + EXPECT_EQ(2.0e-2, APFloat(APFloat::IEEEdouble(), "2.e-2").convertToDouble()); + EXPECT_EQ(2.05e2, + APFloat(APFloat::IEEEdouble(), "002.05000e2").convertToDouble()); + EXPECT_EQ(2.05e+2, + APFloat(APFloat::IEEEdouble(), "002.05000e+2").convertToDouble()); + EXPECT_EQ(2.05e-2, + APFloat(APFloat::IEEEdouble(), "002.05000e-2").convertToDouble()); + EXPECT_EQ(2.05e12, + APFloat(APFloat::IEEEdouble(), "002.05000e12").convertToDouble()); + EXPECT_EQ(2.05e+12, + APFloat(APFloat::IEEEdouble(), "002.05000e+12").convertToDouble()); + EXPECT_EQ(2.05e-12, + APFloat(APFloat::IEEEdouble(), "002.05000e-12").convertToDouble()); + + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "+1e").convertToDouble()); + EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-1e").convertToDouble()); + + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.e").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "+1.e").convertToDouble()); + EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-1.e").convertToDouble()); + + EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble()); + EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), "+.1e").convertToDouble()); + EXPECT_EQ(-0.1, APFloat(APFloat::IEEEdouble(), "-.1e").convertToDouble()); + + EXPECT_EQ(1.1, APFloat(APFloat::IEEEdouble(), "1.1e").convertToDouble()); + EXPECT_EQ(1.1, APFloat(APFloat::IEEEdouble(), "+1.1e").convertToDouble()); + EXPECT_EQ(-1.1, APFloat(APFloat::IEEEdouble(), "-1.1e").convertToDouble()); + + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e+").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1e-").convertToDouble()); + + EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e").convertToDouble()); + EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e+").convertToDouble()); + EXPECT_EQ(0.1, APFloat(APFloat::IEEEdouble(), ".1e-").convertToDouble()); + + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e+").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "1.0e-").convertToDouble()); // These are "carefully selected" to overflow the fast log-base // calculations in APFloat.cpp @@ -1033,8 +1078,9 @@ } TEST(APFloatTest, fromToStringSpecials) { - auto expects = [] (const char *first, const char *second) { - std::string roundtrip = convertToString(convertToDoubleFromString(second), 0, 3); + auto expects = [](const char *first, const char *second) { + std::string roundtrip = + convertToString(convertToDoubleFromString(second), 0, 3); EXPECT_STREQ(first, roundtrip.c_str()); }; expects("+Inf", "+Inf"); @@ -1050,84 +1096,111 @@ } TEST(APFloatTest, fromHexadecimalString) { - EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p0").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "0x1p0").convertToDouble()); EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p0").convertToDouble()); EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p0").convertToDouble()); - EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p+0").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "0x1p+0").convertToDouble()); EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p+0").convertToDouble()); EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p+0").convertToDouble()); - EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble(), "0x1p-0").convertToDouble()); + EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "0x1p-0").convertToDouble()); EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble(), "+0x1p-0").convertToDouble()); EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble(), "-0x1p-0").convertToDouble()); - - EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble(), "0x1p1").convertToDouble()); + EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "0x1p1").convertToDouble()); EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble(), "+0x1p1").convertToDouble()); EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-0x1p1").convertToDouble()); - EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble(), "0x1p+1").convertToDouble()); + EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble(), "0x1p+1").convertToDouble()); EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble(), "+0x1p+1").convertToDouble()); EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble(), "-0x1p+1").convertToDouble()); - EXPECT_EQ( 0.5, APFloat(APFloat::IEEEdouble(), "0x1p-1").convertToDouble()); + EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble(), "0x1p-1").convertToDouble()); EXPECT_EQ(+0.5, APFloat(APFloat::IEEEdouble(), "+0x1p-1").convertToDouble()); EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble(), "-0x1p-1").convertToDouble()); - - EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p1").convertToDouble()); + EXPECT_EQ(3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p1").convertToDouble()); EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble(), "+0x1.8p1").convertToDouble()); EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble(), "-0x1.8p1").convertToDouble()); - EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p+1").convertToDouble()); - EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble(), "+0x1.8p+1").convertToDouble()); - EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble(), "-0x1.8p+1").convertToDouble()); - - EXPECT_EQ( 0.75, APFloat(APFloat::IEEEdouble(), "0x1.8p-1").convertToDouble()); - EXPECT_EQ(+0.75, APFloat(APFloat::IEEEdouble(), "+0x1.8p-1").convertToDouble()); - EXPECT_EQ(-0.75, APFloat(APFloat::IEEEdouble(), "-0x1.8p-1").convertToDouble()); - - - EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p1").convertToDouble()); - EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p1").convertToDouble()); - EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p1").convertToDouble()); - - EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p+1").convertToDouble()); - EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p+1").convertToDouble()); - EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p+1").convertToDouble()); - - EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble(), "0x1000.000p-1").convertToDouble()); - EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble(), "+0x1000.000p-1").convertToDouble()); - EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble(), "-0x1000.000p-1").convertToDouble()); - - - EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000p1").convertToDouble()); - EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000p1").convertToDouble()); - EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000p1").convertToDouble()); - - EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble(), "0x1000p+1").convertToDouble()); - EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble(), "+0x1000p+1").convertToDouble()); - EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble(), "-0x1000p+1").convertToDouble()); - - EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble(), "0x1000p-1").convertToDouble()); - EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble(), "+0x1000p-1").convertToDouble()); - EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble(), "-0x1000p-1").convertToDouble()); - - - EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble(), "0x10p10").convertToDouble()); - EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble(), "+0x10p10").convertToDouble()); - EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble(), "-0x10p10").convertToDouble()); - - EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble(), "0x10p+10").convertToDouble()); - EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble(), "+0x10p+10").convertToDouble()); - EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble(), "-0x10p+10").convertToDouble()); - - EXPECT_EQ( 0.015625, APFloat(APFloat::IEEEdouble(), "0x10p-10").convertToDouble()); - EXPECT_EQ(+0.015625, APFloat(APFloat::IEEEdouble(), "+0x10p-10").convertToDouble()); - EXPECT_EQ(-0.015625, APFloat(APFloat::IEEEdouble(), "-0x10p-10").convertToDouble()); - - EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble(), "0x1.1p0").convertToDouble()); + EXPECT_EQ(3.0, APFloat(APFloat::IEEEdouble(), "0x1.8p+1").convertToDouble()); + EXPECT_EQ(+3.0, + APFloat(APFloat::IEEEdouble(), "+0x1.8p+1").convertToDouble()); + EXPECT_EQ(-3.0, + APFloat(APFloat::IEEEdouble(), "-0x1.8p+1").convertToDouble()); + + EXPECT_EQ(0.75, APFloat(APFloat::IEEEdouble(), "0x1.8p-1").convertToDouble()); + EXPECT_EQ(+0.75, + APFloat(APFloat::IEEEdouble(), "+0x1.8p-1").convertToDouble()); + EXPECT_EQ(-0.75, + APFloat(APFloat::IEEEdouble(), "-0x1.8p-1").convertToDouble()); + + EXPECT_EQ(8192.0, + APFloat(APFloat::IEEEdouble(), "0x1000.000p1").convertToDouble()); + EXPECT_EQ(+8192.0, + APFloat(APFloat::IEEEdouble(), "+0x1000.000p1").convertToDouble()); + EXPECT_EQ(-8192.0, + APFloat(APFloat::IEEEdouble(), "-0x1000.000p1").convertToDouble()); + + EXPECT_EQ(8192.0, + APFloat(APFloat::IEEEdouble(), "0x1000.000p+1").convertToDouble()); + EXPECT_EQ(+8192.0, + APFloat(APFloat::IEEEdouble(), "+0x1000.000p+1").convertToDouble()); + EXPECT_EQ(-8192.0, + APFloat(APFloat::IEEEdouble(), "-0x1000.000p+1").convertToDouble()); + + EXPECT_EQ(2048.0, + APFloat(APFloat::IEEEdouble(), "0x1000.000p-1").convertToDouble()); + EXPECT_EQ(+2048.0, + APFloat(APFloat::IEEEdouble(), "+0x1000.000p-1").convertToDouble()); + EXPECT_EQ(-2048.0, + APFloat(APFloat::IEEEdouble(), "-0x1000.000p-1").convertToDouble()); + + EXPECT_EQ(8192.0, + APFloat(APFloat::IEEEdouble(), "0x1000p1").convertToDouble()); + EXPECT_EQ(+8192.0, + APFloat(APFloat::IEEEdouble(), "+0x1000p1").convertToDouble()); + EXPECT_EQ(-8192.0, + APFloat(APFloat::IEEEdouble(), "-0x1000p1").convertToDouble()); + + EXPECT_EQ(8192.0, + APFloat(APFloat::IEEEdouble(), "0x1000p+1").convertToDouble()); + EXPECT_EQ(+8192.0, + APFloat(APFloat::IEEEdouble(), "+0x1000p+1").convertToDouble()); + EXPECT_EQ(-8192.0, + APFloat(APFloat::IEEEdouble(), "-0x1000p+1").convertToDouble()); + + EXPECT_EQ(2048.0, + APFloat(APFloat::IEEEdouble(), "0x1000p-1").convertToDouble()); + EXPECT_EQ(+2048.0, + APFloat(APFloat::IEEEdouble(), "+0x1000p-1").convertToDouble()); + EXPECT_EQ(-2048.0, + APFloat(APFloat::IEEEdouble(), "-0x1000p-1").convertToDouble()); + + EXPECT_EQ(16384.0, + APFloat(APFloat::IEEEdouble(), "0x10p10").convertToDouble()); + EXPECT_EQ(+16384.0, + APFloat(APFloat::IEEEdouble(), "+0x10p10").convertToDouble()); + EXPECT_EQ(-16384.0, + APFloat(APFloat::IEEEdouble(), "-0x10p10").convertToDouble()); + + EXPECT_EQ(16384.0, + APFloat(APFloat::IEEEdouble(), "0x10p+10").convertToDouble()); + EXPECT_EQ(+16384.0, + APFloat(APFloat::IEEEdouble(), "+0x10p+10").convertToDouble()); + EXPECT_EQ(-16384.0, + APFloat(APFloat::IEEEdouble(), "-0x10p+10").convertToDouble()); + + EXPECT_EQ(0.015625, + APFloat(APFloat::IEEEdouble(), "0x10p-10").convertToDouble()); + EXPECT_EQ(+0.015625, + APFloat(APFloat::IEEEdouble(), "+0x10p-10").convertToDouble()); + EXPECT_EQ(-0.015625, + APFloat(APFloat::IEEEdouble(), "-0x10p-10").convertToDouble()); + + EXPECT_EQ(1.0625, + APFloat(APFloat::IEEEdouble(), "0x1.1p0").convertToDouble()); EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble(), "0x1p0").convertToDouble()); EXPECT_EQ(convertToDoubleFromString("0x1p-150"), @@ -1145,11 +1218,14 @@ ASSERT_EQ("0.0101", convertToString(1.01E-2, 5, 2)); ASSERT_EQ("0.0101", convertToString(1.01E-2, 4, 2)); ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 5, 1)); - ASSERT_EQ("0.78539816339744828", convertToString(0.78539816339744830961, 0, 3)); - ASSERT_EQ("4.9406564584124654E-324", convertToString(4.9406564584124654e-324, 0, 3)); + ASSERT_EQ("0.78539816339744828", + convertToString(0.78539816339744830961, 0, 3)); + ASSERT_EQ("4.9406564584124654E-324", + convertToString(4.9406564584124654e-324, 0, 3)); ASSERT_EQ("873.18340000000001", convertToString(873.1834, 0, 1)); ASSERT_EQ("8.7318340000000001E+2", convertToString(873.1834, 0, 0)); - ASSERT_EQ("1.7976931348623157E+308", convertToString(1.7976931348623157E+308, 0, 0)); + ASSERT_EQ("1.7976931348623157E+308", + convertToString(1.7976931348623157E+308, 0, 0)); ASSERT_EQ("10", convertToString(10.0, 6, 3, false)); ASSERT_EQ("1.000000e+01", convertToString(10.0, 6, 0, false)); ASSERT_EQ("10100", convertToString(1.01E+4, 5, 2, false)); @@ -1181,44 +1257,44 @@ EXPECT_EQ(APFloat::opOK, APFloat(APFloat::IEEEdouble(), "10") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_TRUE(isExact); EXPECT_EQ(APSInt(APInt(5, 10), true), result); EXPECT_EQ(APFloat::opInvalidOp, APFloat(APFloat::IEEEdouble(), "-10") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_FALSE(isExact); EXPECT_EQ(APSInt::getMinValue(5, true), result); EXPECT_EQ(APFloat::opInvalidOp, APFloat(APFloat::IEEEdouble(), "32") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_FALSE(isExact); EXPECT_EQ(APSInt::getMaxValue(5, true), result); EXPECT_EQ(APFloat::opInexact, APFloat(APFloat::IEEEdouble(), "7.9") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_FALSE(isExact); EXPECT_EQ(APSInt(APInt(5, 7), true), result); result.setIsUnsigned(false); EXPECT_EQ(APFloat::opOK, APFloat(APFloat::IEEEdouble(), "-10") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_TRUE(isExact); EXPECT_EQ(APSInt(APInt(5, -10, true), false), result); EXPECT_EQ(APFloat::opInvalidOp, APFloat(APFloat::IEEEdouble(), "-17") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_FALSE(isExact); EXPECT_EQ(APSInt::getMinValue(5, false), result); EXPECT_EQ(APFloat::opInvalidOp, APFloat(APFloat::IEEEdouble(), "16") - .convertToInteger(result, APFloat::rmTowardZero, &isExact)); + .convertToInteger(result, APFloat::rmTowardZero, &isExact)); EXPECT_FALSE(isExact); EXPECT_EQ(APSInt::getMaxValue(5, false), result); } @@ -1240,31 +1316,42 @@ bool Negative; uint64_t payload; } tests[] = { - /* expected semantics SNaN Neg payload */ - { 0x7fc00000ULL, APFloat::IEEEsingle(), false, false, 0x00000000ULL }, - { 0xffc00000ULL, APFloat::IEEEsingle(), false, true, 0x00000000ULL }, - { 0x7fc0ae72ULL, APFloat::IEEEsingle(), false, false, 0x0000ae72ULL }, - { 0x7fffae72ULL, APFloat::IEEEsingle(), false, false, 0xffffae72ULL }, - { 0x7fdaae72ULL, APFloat::IEEEsingle(), false, false, 0x00daae72ULL }, - { 0x7fa00000ULL, APFloat::IEEEsingle(), true, false, 0x00000000ULL }, - { 0xffa00000ULL, APFloat::IEEEsingle(), true, true, 0x00000000ULL }, - { 0x7f80ae72ULL, APFloat::IEEEsingle(), true, false, 0x0000ae72ULL }, - { 0x7fbfae72ULL, APFloat::IEEEsingle(), true, false, 0xffffae72ULL }, - { 0x7f9aae72ULL, APFloat::IEEEsingle(), true, false, 0x001aae72ULL }, - { 0x7ff8000000000000ULL, APFloat::IEEEdouble(), false, false, 0x0000000000000000ULL }, - { 0xfff8000000000000ULL, APFloat::IEEEdouble(), false, true, 0x0000000000000000ULL }, - { 0x7ff800000000ae72ULL, APFloat::IEEEdouble(), false, false, 0x000000000000ae72ULL }, - { 0x7fffffffffffae72ULL, APFloat::IEEEdouble(), false, false, 0xffffffffffffae72ULL }, - { 0x7ffdaaaaaaaaae72ULL, APFloat::IEEEdouble(), false, false, 0x000daaaaaaaaae72ULL }, - { 0x7ff4000000000000ULL, APFloat::IEEEdouble(), true, false, 0x0000000000000000ULL }, - { 0xfff4000000000000ULL, APFloat::IEEEdouble(), true, true, 0x0000000000000000ULL }, - { 0x7ff000000000ae72ULL, APFloat::IEEEdouble(), true, false, 0x000000000000ae72ULL }, - { 0x7ff7ffffffffae72ULL, APFloat::IEEEdouble(), true, false, 0xffffffffffffae72ULL }, - { 0x7ff1aaaaaaaaae72ULL, APFloat::IEEEdouble(), true, false, 0x0001aaaaaaaaae72ULL }, + /* expected semantics SNaN Neg payload */ + {0x7fc00000ULL, APFloat::IEEEsingle(), false, false, 0x00000000ULL}, + {0xffc00000ULL, APFloat::IEEEsingle(), false, true, 0x00000000ULL}, + {0x7fc0ae72ULL, APFloat::IEEEsingle(), false, false, 0x0000ae72ULL}, + {0x7fffae72ULL, APFloat::IEEEsingle(), false, false, 0xffffae72ULL}, + {0x7fdaae72ULL, APFloat::IEEEsingle(), false, false, 0x00daae72ULL}, + {0x7fa00000ULL, APFloat::IEEEsingle(), true, false, 0x00000000ULL}, + {0xffa00000ULL, APFloat::IEEEsingle(), true, true, 0x00000000ULL}, + {0x7f80ae72ULL, APFloat::IEEEsingle(), true, false, 0x0000ae72ULL}, + {0x7fbfae72ULL, APFloat::IEEEsingle(), true, false, 0xffffae72ULL}, + {0x7f9aae72ULL, APFloat::IEEEsingle(), true, false, 0x001aae72ULL}, + {0x7ff8000000000000ULL, APFloat::IEEEdouble(), false, false, + 0x0000000000000000ULL}, + {0xfff8000000000000ULL, APFloat::IEEEdouble(), false, true, + 0x0000000000000000ULL}, + {0x7ff800000000ae72ULL, APFloat::IEEEdouble(), false, false, + 0x000000000000ae72ULL}, + {0x7fffffffffffae72ULL, APFloat::IEEEdouble(), false, false, + 0xffffffffffffae72ULL}, + {0x7ffdaaaaaaaaae72ULL, APFloat::IEEEdouble(), false, false, + 0x000daaaaaaaaae72ULL}, + {0x7ff4000000000000ULL, APFloat::IEEEdouble(), true, false, + 0x0000000000000000ULL}, + {0xfff4000000000000ULL, APFloat::IEEEdouble(), true, true, + 0x0000000000000000ULL}, + {0x7ff000000000ae72ULL, APFloat::IEEEdouble(), true, false, + 0x000000000000ae72ULL}, + {0x7ff7ffffffffae72ULL, APFloat::IEEEdouble(), true, false, + 0xffffffffffffae72ULL}, + {0x7ff1aaaaaaaaae72ULL, APFloat::IEEEdouble(), true, false, + 0x0001aaaaaaaaae72ULL}, }; for (const auto &t : tests) { - ASSERT_EQ(t.expected, nanbitsFromAPInt(t.semantics, t.SNaN, t.Negative, t.payload)); + ASSERT_EQ(t.expected, + nanbitsFromAPInt(t.semantics, t.SNaN, t.Negative, t.payload)); } } @@ -1284,15 +1371,32 @@ EXPECT_EQ("String has no digits", convertToErrorFromString("+")); EXPECT_EQ("String has no digits", convertToErrorFromString("-")); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("\0", 1))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("1\0", 2))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("1" "\0" "2", 3))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("1" "\0" "2e1", 5))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("1e\0", 3))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("1e1\0", 4))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("1e1" "\0" "2", 5))); - - EXPECT_EQ("Invalid character in significand", convertToErrorFromString("1.0f")); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("\0", 1))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("1\0", 2))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("1" + "\0" + "2", + 3))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("1" + "\0" + "2e1", + 5))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("1e\0", 3))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("1e1\0", 4))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("1e1" + "\0" + "2", + 5))); + + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString("1.0f")); EXPECT_EQ("String contains multiple dots", convertToErrorFromString("..")); EXPECT_EQ("String contains multiple dots", convertToErrorFromString("..0")); @@ -1300,145 +1404,170 @@ } TEST(APFloatTest, StringDecimalSignificandError) { - EXPECT_EQ("Significand has no digits", convertToErrorFromString( ".")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString(".")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+.")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-.")); - - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "e")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("e")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+e")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-e")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "e1")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("e1")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+e1")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-e1")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( ".e1")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString(".e1")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+.e1")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-.e1")); - - EXPECT_EQ("Significand has no digits", convertToErrorFromString( ".e")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString(".e")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+.e")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-.e")); } TEST(APFloatTest, StringHexadecimalError) { - EXPECT_EQ("Invalid string", convertToErrorFromString( "0x")); + EXPECT_EQ("Invalid string", convertToErrorFromString("0x")); EXPECT_EQ("Invalid string", convertToErrorFromString("+0x")); EXPECT_EQ("Invalid string", convertToErrorFromString("-0x")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString( "0x0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("+0x0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("-0x0")); - - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString( "0x0.")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("+0x0.")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("-0x0.")); - - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString( "0x.0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("+0x.0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("-0x.0")); - - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString( "0x0.0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("+0x0.0")); - EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("-0x0.0")); - - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("0x\0", 3))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("0x1\0", 4))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("0x1" "\0" "2", 5))); - EXPECT_EQ("Invalid character in significand", convertToErrorFromString(StringRef("0x1" "\0" "2p1", 7))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("0x1p\0", 5))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("0x1p1\0", 6))); - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString(StringRef("0x1p1" "\0" "2", 7))); - - EXPECT_EQ("Invalid character in exponent", convertToErrorFromString("0x1p0f")); - - EXPECT_EQ("String contains multiple dots", convertToErrorFromString("0x..p1")); - EXPECT_EQ("String contains multiple dots", convertToErrorFromString("0x..0p1")); - EXPECT_EQ("String contains multiple dots", convertToErrorFromString("0x1.0.0p1")); + EXPECT_EQ("Hex strings require an exponent", convertToErrorFromString("0x0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("+0x0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("-0x0")); + + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("0x0.")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("+0x0.")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("-0x0.")); + + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("0x.0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("+0x.0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("-0x.0")); + + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("0x0.0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("+0x0.0")); + EXPECT_EQ("Hex strings require an exponent", + convertToErrorFromString("-0x0.0")); + + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("0x\0", 3))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("0x1\0", 4))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("0x1" + "\0" + "2", + 5))); + EXPECT_EQ("Invalid character in significand", + convertToErrorFromString(StringRef("0x1" + "\0" + "2p1", + 7))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("0x1p\0", 5))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("0x1p1\0", 6))); + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString(StringRef("0x1p1" + "\0" + "2", + 7))); + + EXPECT_EQ("Invalid character in exponent", + convertToErrorFromString("0x1p0f")); + + EXPECT_EQ("String contains multiple dots", + convertToErrorFromString("0x..p1")); + EXPECT_EQ("String contains multiple dots", + convertToErrorFromString("0x..0p1")); + EXPECT_EQ("String contains multiple dots", + convertToErrorFromString("0x1.0.0p1")); } TEST(APFloatTest, StringHexadecimalSignificandError) { - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0x.")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0x.")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0x.")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0x.")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0xp")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0xp")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0xp")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0xp")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0xp+")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0xp+")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0xp+")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0xp+")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0xp-")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0xp-")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0xp-")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0xp-")); - - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0x.p")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0x.p")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0x.p")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0x.p")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0x.p+")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0x.p+")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0x.p+")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0x.p+")); - EXPECT_EQ("Significand has no digits", convertToErrorFromString( "0x.p-")); + EXPECT_EQ("Significand has no digits", convertToErrorFromString("0x.p-")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("+0x.p-")); EXPECT_EQ("Significand has no digits", convertToErrorFromString("-0x.p-")); } TEST(APFloatTest, StringHexadecimalExponentError) { - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1p")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1p")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1p+")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1p+")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1p-")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1p-")); - - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.p")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.p")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.p+")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.p+")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.p-")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.p-")); - - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x.1p")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x.1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x.1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x.1p")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x.1p+")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x.1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x.1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x.1p+")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x.1p-")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x.1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x.1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x.1p-")); - - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.1p")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.1p")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.1p")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.1p+")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.1p+")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.1p+")); - EXPECT_EQ("Exponent has no digits", convertToErrorFromString( "0x1.1p-")); + EXPECT_EQ("Exponent has no digits", convertToErrorFromString("0x1.1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("+0x1.1p-")); EXPECT_EQ("Exponent has no digits", convertToErrorFromString("-0x1.1p-")); } @@ -1455,7 +1584,8 @@ EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::IEEEquad(), "0.5"))); EXPECT_TRUE(APFloat(APFloat::PPCDoubleDouble(), "2.0").getExactInverse(&inv)); EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::PPCDoubleDouble(), "0.5"))); - EXPECT_TRUE(APFloat(APFloat::x87DoubleExtended(), "2.0").getExactInverse(&inv)); + EXPECT_TRUE( + APFloat(APFloat::x87DoubleExtended(), "2.0").getExactInverse(&inv)); EXPECT_TRUE(inv.bitwiseIsEqual(APFloat(APFloat::x87DoubleExtended(), "0.5"))); // FLT_MIN @@ -1471,7 +1601,8 @@ } TEST(APFloatTest, roundToIntegral) { - APFloat T(-0.5), S(3.14), R(APFloat::getLargest(APFloat::IEEEdouble())), P(0.0); + APFloat T(-0.5), S(3.14), R(APFloat::getLargest(APFloat::IEEEdouble())), + P(0.0); P = T; P.roundToIntegral(APFloat::rmTowardZero); @@ -1671,18 +1802,20 @@ APFloat F3(3.14159); APFloat F4(-0.0); llvm::detail::DoubleAPFloat T2(APFloat::PPCDoubleDouble(), std::move(F3), - std::move(F4)); + std::move(F4)); EXPECT_FALSE(T2.isInteger()); APFloat F5(-0.0); APFloat F6(3.14159); llvm::detail::DoubleAPFloat T3(APFloat::PPCDoubleDouble(), std::move(F5), - std::move(F6)); + std::move(F6)); EXPECT_FALSE(T3.isInteger()); } TEST(APFloatTest, getLargest) { - EXPECT_EQ(3.402823466e+38f, APFloat::getLargest(APFloat::IEEEsingle()).convertToFloat()); - EXPECT_EQ(1.7976931348623158e+308, APFloat::getLargest(APFloat::IEEEdouble()).convertToDouble()); + EXPECT_EQ(3.402823466e+38f, + APFloat::getLargest(APFloat::IEEEsingle()).convertToFloat()); + EXPECT_EQ(1.7976931348623158e+308, + APFloat::getLargest(APFloat::IEEEdouble()).convertToDouble()); } TEST(APFloatTest, getSmallest) { @@ -1701,14 +1834,16 @@ EXPECT_TRUE(test.bitwiseIsEqual(expected)); test = APFloat::getSmallest(APFloat::IEEEquad(), false); - expected = APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "0x0.0000000000000000000000000001p-16382"); EXPECT_FALSE(test.isNegative()); EXPECT_TRUE(test.isFiniteNonZero()); EXPECT_TRUE(test.isDenormal()); EXPECT_TRUE(test.bitwiseIsEqual(expected)); test = APFloat::getSmallest(APFloat::IEEEquad(), true); - expected = APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); + expected = + APFloat(APFloat::IEEEquad(), "-0x0.0000000000000000000000000001p-16382"); EXPECT_TRUE(test.isNegative()); EXPECT_TRUE(test.isFiniteNonZero()); EXPECT_TRUE(test.isDenormal()); @@ -1752,32 +1887,36 @@ const unsigned long long bitPattern[2]; const unsigned bitPatternLength; } const GetZeroTest[] = { - { &APFloat::IEEEhalf(), false, {0, 0}, 1}, - { &APFloat::IEEEhalf(), true, {0x8000ULL, 0}, 1}, - { &APFloat::IEEEsingle(), false, {0, 0}, 1}, - { &APFloat::IEEEsingle(), true, {0x80000000ULL, 0}, 1}, - { &APFloat::IEEEdouble(), false, {0, 0}, 1}, - { &APFloat::IEEEdouble(), true, {0x8000000000000000ULL, 0}, 1}, - { &APFloat::IEEEquad(), false, {0, 0}, 2}, - { &APFloat::IEEEquad(), true, {0, 0x8000000000000000ULL}, 2}, - { &APFloat::PPCDoubleDouble(), false, {0, 0}, 2}, - { &APFloat::PPCDoubleDouble(), true, {0x8000000000000000ULL, 0}, 2}, - { &APFloat::x87DoubleExtended(), false, {0, 0}, 2}, - { &APFloat::x87DoubleExtended(), true, {0, 0x8000ULL}, 2}, + {&APFloat::IEEEhalf(), false, {0, 0}, 1}, + {&APFloat::IEEEhalf(), true, {0x8000ULL, 0}, 1}, + {&APFloat::IEEEsingle(), false, {0, 0}, 1}, + {&APFloat::IEEEsingle(), true, {0x80000000ULL, 0}, 1}, + {&APFloat::IEEEdouble(), false, {0, 0}, 1}, + {&APFloat::IEEEdouble(), true, {0x8000000000000000ULL, 0}, 1}, + {&APFloat::IEEEquad(), false, {0, 0}, 2}, + {&APFloat::IEEEquad(), true, {0, 0x8000000000000000ULL}, 2}, + {&APFloat::PPCDoubleDouble(), false, {0, 0}, 2}, + {&APFloat::PPCDoubleDouble(), true, {0x8000000000000000ULL, 0}, 2}, + {&APFloat::x87DoubleExtended(), false, {0, 0}, 2}, + {&APFloat::x87DoubleExtended(), true, {0, 0x8000ULL}, 2}, + {&APFloat::F8M2(), false, {0, 0}, 1}, + {&APFloat::F8M2(), true, {0x80ULL, 0}, 1}, }; - const unsigned NumGetZeroTests = 12; + const unsigned NumGetZeroTests = sizeof(GetZeroTest) / sizeof(GetZeroTest[0]); + assert(NumGetZeroTests == 14); for (unsigned i = 0; i < NumGetZeroTests; ++i) { - APFloat test = APFloat::getZero(*GetZeroTest[i].semantics, - GetZeroTest[i].sign); - const char *pattern = GetZeroTest[i].sign? "-0x0p+0" : "0x0p+0"; - APFloat expected = APFloat(*GetZeroTest[i].semantics, - pattern); - EXPECT_TRUE(test.isZero()); - EXPECT_TRUE(GetZeroTest[i].sign? test.isNegative() : !test.isNegative()); - EXPECT_TRUE(test.bitwiseIsEqual(expected)); + APFloat test = + APFloat::getZero(*GetZeroTest[i].semantics, GetZeroTest[i].sign); + const char *pattern = GetZeroTest[i].sign ? "-0x0p+0" : "0x0p+0"; + APFloat expected = APFloat(*GetZeroTest[i].semantics, pattern); + EXPECT_TRUE(test.isZero()) << "(case " << i << ")"; + EXPECT_TRUE(GetZeroTest[i].sign ? test.isNegative() : !test.isNegative()) + << "(cas " << i << ")"; + EXPECT_TRUE(test.bitwiseIsEqual(expected)) << "(case " << i << ")"; for (unsigned j = 0, je = GetZeroTest[i].bitPatternLength; j < je; ++j) { EXPECT_EQ(GetZeroTest[i].bitPattern[j], - test.bitcastToAPInt().getRawData()[j]); + test.bitcastToAPInt().getRawData()[j]) + << "(case " << i << ")"; } } } @@ -1801,7 +1940,8 @@ EXPECT_FALSE(losesInfo); test = APFloat(APFloat::x87DoubleExtended(), "0x1p-53"); - test.add(APFloat(APFloat::x87DoubleExtended(), "1.0"), APFloat::rmNearestTiesToEven); + test.add(APFloat(APFloat::x87DoubleExtended(), "1.0"), + APFloat::rmNearestTiesToEven); test.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &losesInfo); EXPECT_EQ(1.0, test.convertToDouble()); EXPECT_TRUE(losesInfo); @@ -1818,10 +1958,13 @@ EXPECT_FALSE(losesInfo); test = APFloat::getSNaN(APFloat::IEEEsingle()); - APFloat::opStatus status = test.convert(APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven, &losesInfo); - // Conversion quiets the SNAN, so now 2 bits of the 64-bit significand should be set. + APFloat::opStatus status = test.convert( + APFloat::x87DoubleExtended(), APFloat::rmNearestTiesToEven, &losesInfo); + // Conversion quiets the SNAN, so now 2 bits of the 64-bit significand should + // be set. APInt topTwoBits(64, 0x6000000000000000); - EXPECT_TRUE(test.bitwiseIsEqual(APFloat::getQNaN(APFloat::x87DoubleExtended(), false, &topTwoBits))); + EXPECT_TRUE(test.bitwiseIsEqual( + APFloat::getQNaN(APFloat::x87DoubleExtended(), false, &topTwoBits))); EXPECT_FALSE(losesInfo); EXPECT_EQ(status, APFloat::opInvalidOp); @@ -1845,17 +1988,20 @@ EXPECT_TRUE(test.bitwiseIsEqual(X87QNaN)); EXPECT_FALSE(losesInfo); - // The payload is lost in truncation, but we retain NaN by setting the quiet bit. + // The payload is lost in truncation, but we retain NaN by setting the quiet + // bit. APInt payload(52, 1); test = APFloat::getSNaN(APFloat::IEEEdouble(), false, &payload); - status = test.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &losesInfo); + status = test.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, + &losesInfo); EXPECT_EQ(0x7fc00000, test.bitcastToAPInt()); EXPECT_TRUE(losesInfo); EXPECT_EQ(status, APFloat::opInvalidOp); // The payload is lost in truncation. QNaN remains QNaN. test = APFloat::getQNaN(APFloat::IEEEdouble(), false, &payload); - status = test.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, &losesInfo); + status = test.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven, + &losesInfo); EXPECT_EQ(0x7fc00000, test.bitcastToAPInt()); EXPECT_TRUE(losesInfo); EXPECT_EQ(status, APFloat::opOK); @@ -1909,12 +2055,14 @@ EXPECT_EQ(0x0000000000000000ull, test.bitcastToAPInt().getRawData()[1]); // LDBL_MAX - test = APFloat(APFloat::PPCDoubleDouble(), "1.79769313486231580793728971405301e+308"); + test = APFloat(APFloat::PPCDoubleDouble(), + "1.79769313486231580793728971405301e+308"); EXPECT_EQ(0x7fefffffffffffffull, test.bitcastToAPInt().getRawData()[0]); EXPECT_EQ(0x7c8ffffffffffffeull, test.bitcastToAPInt().getRawData()[1]); // LDBL_MIN - test = APFloat(APFloat::PPCDoubleDouble(), "2.00416836000897277799610805135016e-292"); + test = APFloat(APFloat::PPCDoubleDouble(), + "2.00416836000897277799610805135016e-292"); EXPECT_EQ(0x0360000000000000ull, test.bitcastToAPInt().getRawData()[0]); EXPECT_EQ(0x0000000000000000ull, test.bitcastToAPInt().getRawData()[1]); @@ -2021,7 +2169,8 @@ EXPECT_FALSE(APFloat::getInf(APFloat::IEEEsingle(), true).isFiniteNonZero()); // Test +/- Zero. - EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), false).isFiniteNonZero()); + EXPECT_FALSE( + APFloat::getZero(APFloat::IEEEsingle(), false).isFiniteNonZero()); EXPECT_FALSE(APFloat::getZero(APFloat::IEEEsingle(), true).isFiniteNonZero()); // Test +/- qNaN. +/- dont mean anything with qNaN but paranoia can't hurt in @@ -2031,7 +2180,8 @@ // Test +/- sNaN. +/- dont mean anything with sNaN but paranoia can't hurt in // this instance. - EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), false).isFiniteNonZero()); + EXPECT_FALSE( + APFloat::getSNaN(APFloat::IEEEsingle(), false).isFiniteNonZero()); EXPECT_FALSE(APFloat::getSNaN(APFloat::IEEEsingle(), true).isFiniteNonZero()); } @@ -2051,9 +2201,9 @@ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false); APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true); APFloat PSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); APFloat MSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact; @@ -2064,203 +2214,280 @@ int status; int category; } SpecialCaseTests[] = { - { PInf, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PZero, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PZero, PSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PZero, MSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PZero, PSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PZero, MSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MZero, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MZero, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MZero, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MZero, PSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MZero, MSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MZero, PSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MZero, MSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, PSmallestValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MSmallestValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, PSmallestNormalized, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MSmallestNormalized, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PSmallestValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MSmallestValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PSmallestNormalized, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MSmallestNormalized, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PSmallestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MSmallestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PSmallestNormalized, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MSmallestNormalized, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, PSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PSmallestNormalized, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MSmallestNormalized, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PSmallestValue, "0x1p-148", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, PSmallestNormalized, "0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestNormalized, "-0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, MSmallestValue, "-0x1p-148", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PSmallestNormalized, "0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestNormalized, "-0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestValue, "0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MSmallestValue, "0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestNormalized, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestValue, "-0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MSmallestValue, "-0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, MSmallestNormalized, "-0x1p-125", APFloat::opOK, APFloat::fcNormal } - }; + {PInf, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PZero, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PZero, PSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PZero, MSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PZero, PSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PZero, MSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MZero, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MZero, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MZero, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MZero, PSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MZero, MSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MZero, PSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MZero, MSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, PNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, PSmallestValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MSmallestValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, PSmallestNormalized, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MSmallestNormalized, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, MNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PSmallestValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MSmallestValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PSmallestNormalized, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MSmallestNormalized, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PLargestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, PSmallestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, MSmallestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PSmallestNormalized, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PLargestValue, MSmallestNormalized, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, MLargestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, PSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, MSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, PSmallestNormalized, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MLargestValue, MSmallestNormalized, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, PSmallestValue, "0x1p-148", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestValue, PSmallestNormalized, "0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestNormalized, "-0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, MLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestValue, MSmallestValue, "-0x1p-148", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PSmallestNormalized, "0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestNormalized, "-0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestNormalized, PLargestValue, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestNormalized, MLargestValue, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestNormalized, PSmallestValue, "0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MSmallestValue, "0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PSmallestNormalized, "0x1p-125", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {MSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestNormalized, PLargestValue, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MSmallestNormalized, MLargestValue, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MSmallestNormalized, PSmallestValue, "-0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MSmallestValue, "-0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, MSmallestNormalized, "-0x1p-125", APFloat::opOK, + APFloat::fcNormal}}; for (size_t i = 0; i < std::size(SpecialCaseTests); ++i) { APFloat x(SpecialCaseTests[i].x); @@ -2291,9 +2518,9 @@ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false); APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true); APFloat PSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); APFloat MSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact; @@ -2304,203 +2531,280 @@ int status; int category; } SpecialCaseTests[] = { - { PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PZero, MLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PZero, PSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PZero, MSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PZero, PSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PZero, MSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MZero, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MZero, MLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MZero, PSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MZero, MSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MZero, PSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MZero, MSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, PSmallestValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MSmallestValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, PSmallestNormalized, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PNormalValue, MSmallestNormalized, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, PNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PSmallestValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MSmallestValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, PSmallestNormalized, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MNormalValue, MSmallestNormalized, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, PSmallestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MSmallestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, PSmallestNormalized, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PLargestValue, MSmallestNormalized, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, PSmallestNormalized, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MLargestValue, MSmallestNormalized, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, MSmallestValue, "0x1p-148", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PSmallestNormalized, "-0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestNormalized, "0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestValue, PSmallestValue, "-0x1p-148", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, PSmallestNormalized, "-0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestNormalized, "0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestValue, "0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MSmallestValue, "0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, MSmallestNormalized, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestValue, "-0x1.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MSmallestValue, "-0x1.fffffcp-127", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestNormalized, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero } - }; + {PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PZero, MLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PZero, PSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PZero, MSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PZero, PSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PZero, MSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MZero, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MZero, MLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MZero, PSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MZero, MSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MZero, PSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MZero, MSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, MNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, PSmallestValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MSmallestValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, PSmallestNormalized, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PNormalValue, MSmallestNormalized, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, PNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PSmallestValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MSmallestValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, PSmallestNormalized, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MNormalValue, MSmallestNormalized, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MLargestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, PSmallestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, MSmallestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PLargestValue, PSmallestNormalized, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PLargestValue, MSmallestNormalized, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, PLargestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, PSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, MSmallestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MLargestValue, PSmallestNormalized, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MLargestValue, MSmallestNormalized, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestValue, MSmallestValue, "0x1p-148", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PSmallestNormalized, "-0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestNormalized, "0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, MLargestValue, "0x1.fffffep+127", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestValue, PSmallestValue, "-0x1p-148", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestValue, PSmallestNormalized, "-0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestNormalized, "0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {PSmallestNormalized, PLargestValue, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestNormalized, MLargestValue, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {PSmallestNormalized, PSmallestValue, "0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MSmallestValue, "0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestNormalized, MSmallestNormalized, "0x1p-125", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {MSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, + APFloat::fcNormal}, + {MSmallestNormalized, PLargestValue, "-0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MSmallestNormalized, MLargestValue, "0x1.fffffep+127", + APFloat::opInexact, APFloat::fcNormal}, + {MSmallestNormalized, PSmallestValue, "-0x1.000002p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MSmallestValue, "-0x1.fffffcp-127", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PSmallestNormalized, "-0x1p-125", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}}; for (size_t i = 0; i < std::size(SpecialCaseTests); ++i) { APFloat x(SpecialCaseTests[i].x); @@ -2553,257 +2857,321 @@ int category; APFloat::roundingMode roundingMode = APFloat::rmNearestTiesToEven; } SpecialCaseTests[] = { - { PInf, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PNormalValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MNormalValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PSmallestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MSmallestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PSmallestNormalized, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MSmallestNormalized, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PLargestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, MLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, PSmallestValue, "0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MSmallestValue, "-0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PSmallestNormalized, "0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MSmallestNormalized, "-0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MLargestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, MLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, PSmallestValue, "-0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MSmallestValue, "0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PSmallestNormalized, "-0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MSmallestNormalized, "0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PLargestValue, "0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MLargestValue, "-0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PSmallestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestValue, MSmallestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestValue, PSmallestNormalized, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestValue, MSmallestNormalized, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PLargestValue, "-0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MLargestValue, "0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PSmallestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, MSmallestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, PSmallestNormalized, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, MSmallestNormalized, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PSmallestNormalized, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PLargestValue, "0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MLargestValue, "-0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, MSmallestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, PSmallestNormalized, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, MSmallestNormalized, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MSmallestNormalized, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PLargestValue, "-0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MLargestValue, "0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, MSmallestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, PSmallestNormalized, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, MSmallestNormalized, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - - {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmNearestTiesToEven}, - {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardPositive}, - {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardNegative}, - {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardZero}, - {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmNearestTiesToAway}, - - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmNearestTiesToEven}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardPositive}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardNegative}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmTowardZero}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, - APFloat::fcNormal, APFloat::rmNearestTiesToAway}, - - {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmNearestTiesToEven}, - {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmTowardPositive}, - {MaxQuad, MaxQuad, "0x1.ffffffffffffffffffffffffffffp+16383", - APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardNegative}, - {MaxQuad, MaxQuad, "0x1.ffffffffffffffffffffffffffffp+16383", - APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardZero}, - {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmNearestTiesToAway}, - - {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToEven}, - {MinQuad, MinQuad, "0x0.0000000000000000000000000001p-16382", - UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardPositive}, - {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardNegative}, - {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardZero}, - {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToAway}, - - {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToEven}, - {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardPositive}, - {MinQuad, NMinQuad, "-0x0.0000000000000000000000000001p-16382", - UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardNegative}, - {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardZero}, - {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToAway}, + {PInf, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PNormalValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, MLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, PSmallestValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, MSmallestValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, PSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, MSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MNormalValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, MLargestValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, PSmallestValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, MSmallestValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, PSmallestNormalized, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, MSmallestNormalized, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PLargestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PLargestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, MLargestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, PSmallestValue, "0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MSmallestValue, "-0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PSmallestNormalized, "0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MSmallestNormalized, "-0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MLargestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PLargestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, MLargestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, PSmallestValue, "-0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MSmallestValue, "0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PSmallestNormalized, "-0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MSmallestNormalized, "0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PLargestValue, "0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MLargestValue, "-0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PSmallestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestValue, MSmallestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestValue, PSmallestNormalized, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestValue, MSmallestNormalized, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PLargestValue, "-0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MLargestValue, "0x1.fffffep-22", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PSmallestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, MSmallestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, PSmallestNormalized, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, MSmallestNormalized, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, PInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PSmallestNormalized, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestNormalized, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PLargestValue, "0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MLargestValue, "-0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PSmallestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, MSmallestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, PSmallestNormalized, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, MSmallestNormalized, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MSmallestNormalized, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestNormalized, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PLargestValue, "-0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MLargestValue, "0x1.fffffep+1", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PSmallestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, MSmallestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, PSmallestNormalized, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, MSmallestNormalized, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + + {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, + APFloat::fcNormal, APFloat::rmNearestTiesToEven}, + {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, + APFloat::fcNormal, APFloat::rmTowardPositive}, + {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, + APFloat::fcNormal, APFloat::rmTowardNegative}, + {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, + APFloat::fcNormal, APFloat::rmTowardZero}, + {MaxQuad, MinQuad, "0x1.ffffffffffffffffffffffffffffp-111", APFloat::opOK, + APFloat::fcNormal, APFloat::rmNearestTiesToAway}, + + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", + APFloat::opOK, APFloat::fcNormal, APFloat::rmNearestTiesToEven}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", + APFloat::opOK, APFloat::fcNormal, APFloat::rmTowardPositive}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", + APFloat::opOK, APFloat::fcNormal, APFloat::rmTowardNegative}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", + APFloat::opOK, APFloat::fcNormal, APFloat::rmTowardZero}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp-111", + APFloat::opOK, APFloat::fcNormal, APFloat::rmNearestTiesToAway}, + + {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmNearestTiesToEven}, + {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmTowardPositive}, + {MaxQuad, MaxQuad, "0x1.ffffffffffffffffffffffffffffp+16383", + APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardNegative}, + {MaxQuad, MaxQuad, "0x1.ffffffffffffffffffffffffffffp+16383", + APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardZero}, + {MaxQuad, MaxQuad, "inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmNearestTiesToAway}, + + {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToEven}, + {MinQuad, MinQuad, "0x0.0000000000000000000000000001p-16382", + UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardPositive}, + {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardNegative}, + {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardZero}, + {MinQuad, MinQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToAway}, + + {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToEven}, + {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardPositive}, + {MinQuad, NMinQuad, "-0x0.0000000000000000000000000001p-16382", + UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardNegative}, + {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardZero}, + {MinQuad, NMinQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToAway}, }; for (size_t i = 0; i < std::size(SpecialCaseTests); ++i) { @@ -2857,235 +3225,305 @@ int category; APFloat::roundingMode roundingMode = APFloat::rmNearestTiesToEven; } SpecialCaseTests[] = { - { PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PZero, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PNormalValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PLargestValue, "0x1p-128", UnderflowStatus, APFloat::fcNormal }, - { PNormalValue, MLargestValue, "-0x1p-128", UnderflowStatus, APFloat::fcNormal }, - { PNormalValue, PSmallestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { PNormalValue, MSmallestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { PNormalValue, PSmallestNormalized, "0x1p+126", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MSmallestNormalized, "-0x1p+126", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MNormalValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PLargestValue, "-0x1p-128", UnderflowStatus, APFloat::fcNormal }, - { MNormalValue, MLargestValue, "0x1p-128", UnderflowStatus, APFloat::fcNormal }, - { MNormalValue, PSmallestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MNormalValue, MSmallestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { MNormalValue, PSmallestNormalized, "-0x1p+126", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MSmallestNormalized, "0x1p+126", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PLargestValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MLargestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PSmallestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, MSmallestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, PSmallestNormalized, "inf", OverflowStatus, APFloat::fcInfinity }, - { PLargestValue, MSmallestNormalized, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MLargestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PLargestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PSmallestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, MSmallestValue, "inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, PSmallestNormalized, "-inf", OverflowStatus, APFloat::fcInfinity }, - { MLargestValue, MSmallestNormalized, "inf", OverflowStatus, APFloat::fcInfinity }, - { PSmallestValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PSmallestValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestValue, MLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestValue, PSmallestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PSmallestNormalized, "0x1p-23", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestNormalized, "-0x1p-23", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MSmallestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, MLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestValue, PSmallestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PSmallestNormalized, "-0x1p-23", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestNormalized, "0x1p-23", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PSmallestNormalized, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, MLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { PSmallestNormalized, PSmallestValue, "0x1p+23", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MSmallestValue, "-0x1p+23", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestNormalized, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MSmallestNormalized, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MSmallestNormalized, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, - { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, MLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, - { MSmallestNormalized, PSmallestValue, "-0x1p+23", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MSmallestValue, "0x1p+23", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestNormalized, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MSmallestNormalized, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - - {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmNearestTiesToEven}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp+16383", - APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardPositive}, - {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmTowardNegative}, - {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp+16383", - APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardZero}, - {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, - APFloat::rmNearestTiesToAway}, - - {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToEven}, - {MinQuad, MaxQuad, "0x0.0000000000000000000000000001p-16382", - UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardPositive}, - {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardNegative}, - {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardZero}, - {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToAway}, - - {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToEven}, - {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardPositive}, - {NMinQuad, MaxQuad, "-0x0.0000000000000000000000000001p-16382", - UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardNegative}, - {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmTowardZero}, - {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, - APFloat::rmNearestTiesToAway}, + {PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, PSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PInf, MSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestValue, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestValue, "inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, PSmallestNormalized, "-inf", APFloat::opOK, APFloat::fcInfinity}, + {MInf, MSmallestNormalized, "inf", APFloat::opOK, APFloat::fcInfinity}, + {PZero, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PNormalValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {PNormalValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, PLargestValue, "0x1p-128", UnderflowStatus, + APFloat::fcNormal}, + {PNormalValue, MLargestValue, "-0x1p-128", UnderflowStatus, + APFloat::fcNormal}, + {PNormalValue, PSmallestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PNormalValue, MSmallestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {PNormalValue, PSmallestNormalized, "0x1p+126", APFloat::opOK, + APFloat::fcNormal}, + {PNormalValue, MSmallestNormalized, "-0x1p+126", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {MNormalValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, PLargestValue, "-0x1p-128", UnderflowStatus, + APFloat::fcNormal}, + {MNormalValue, MLargestValue, "0x1p-128", UnderflowStatus, + APFloat::fcNormal}, + {MNormalValue, PSmallestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MNormalValue, MSmallestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {MNormalValue, PSmallestNormalized, "-0x1p+126", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, MSmallestNormalized, "0x1p+126", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {PLargestValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PLargestValue, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MLargestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PSmallestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, MSmallestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, PSmallestNormalized, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PLargestValue, MSmallestNormalized, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {MLargestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PLargestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MLargestValue, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PSmallestValue, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, MSmallestValue, "inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, PSmallestNormalized, "-inf", OverflowStatus, + APFloat::fcInfinity}, + {MLargestValue, MSmallestNormalized, "inf", OverflowStatus, + APFloat::fcInfinity}, + {PSmallestValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {PSmallestValue, MZero, "-inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PLargestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestValue, MLargestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestValue, PSmallestValue, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PSmallestNormalized, "0x1p-23", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestNormalized, "-0x1p-23", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestValue, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestValue, PZero, "-inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {MSmallestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity}, + {MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PLargestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, MLargestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestValue, PSmallestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestValue, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PSmallestNormalized, "-0x1p-23", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestNormalized, "0x1p-23", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestNormalized, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PSmallestNormalized, PZero, "inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {PSmallestNormalized, MZero, "-inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PLargestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, MLargestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {PSmallestNormalized, PSmallestValue, "0x1p+23", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MSmallestValue, "-0x1p+23", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PSmallestNormalized, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MSmallestNormalized, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestNormalized, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MSmallestNormalized, PZero, "-inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {MSmallestNormalized, MZero, "inf", APFloat::opDivByZero, + APFloat::fcInfinity}, + {MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PLargestValue, "-0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, MLargestValue, "0x0p+0", UnderflowStatus, + APFloat::fcZero}, + {MSmallestNormalized, PSmallestValue, "-0x1p+23", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MSmallestValue, "0x1p+23", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PSmallestNormalized, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MSmallestNormalized, "0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + + {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmNearestTiesToEven}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp+16383", + APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardPositive}, + {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmTowardNegative}, + {MaxQuad, NMinQuad, "-0x1.ffffffffffffffffffffffffffffp+16383", + APFloat::opInexact, APFloat::fcNormal, APFloat::rmTowardZero}, + {MaxQuad, NMinQuad, "-inf", OverflowStatus, APFloat::fcInfinity, + APFloat::rmNearestTiesToAway}, + + {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToEven}, + {MinQuad, MaxQuad, "0x0.0000000000000000000000000001p-16382", + UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardPositive}, + {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardNegative}, + {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardZero}, + {MinQuad, MaxQuad, "0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToAway}, + + {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToEven}, + {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardPositive}, + {NMinQuad, MaxQuad, "-0x0.0000000000000000000000000001p-16382", + UnderflowStatus, APFloat::fcNormal, APFloat::rmTowardNegative}, + {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmTowardZero}, + {NMinQuad, MaxQuad, "-0", UnderflowStatus, APFloat::fcZero, + APFloat::rmNearestTiesToAway}, }; for (size_t i = 0; i < std::size(SpecialCaseTests); ++i) { @@ -3112,18 +3550,18 @@ } TEST(APFloatTest, Comparisons) { - enum {MNan, MInf, MBig, MOne, MZer, PZer, POne, PBig, PInf, PNan, NumVals}; + enum { MNan, MInf, MBig, MOne, MZer, PZer, POne, PBig, PInf, PNan, NumVals }; APFloat Vals[NumVals] = { - APFloat::getNaN(APFloat::IEEEsingle(), true), - APFloat::getInf(APFloat::IEEEsingle(), true), - APFloat::getLargest(APFloat::IEEEsingle(), true), - APFloat(APFloat::IEEEsingle(), "-0x1p+0"), - APFloat::getZero(APFloat::IEEEsingle(), true), - APFloat::getZero(APFloat::IEEEsingle(), false), - APFloat(APFloat::IEEEsingle(), "0x1p+0"), - APFloat::getLargest(APFloat::IEEEsingle(), false), - APFloat::getInf(APFloat::IEEEsingle(), false), - APFloat::getNaN(APFloat::IEEEsingle(), false), + APFloat::getNaN(APFloat::IEEEsingle(), true), + APFloat::getInf(APFloat::IEEEsingle(), true), + APFloat::getLargest(APFloat::IEEEsingle(), true), + APFloat(APFloat::IEEEsingle(), "-0x1p+0"), + APFloat::getZero(APFloat::IEEEsingle(), true), + APFloat::getZero(APFloat::IEEEsingle(), false), + APFloat(APFloat::IEEEsingle(), "0x1p+0"), + APFloat::getLargest(APFloat::IEEEsingle(), false), + APFloat::getInf(APFloat::IEEEsingle(), false), + APFloat::getNaN(APFloat::IEEEsingle(), false), }; using Relation = void (*)(const APFloat &, const APFloat &); Relation LT = [](const APFloat &LHS, const APFloat &RHS) { @@ -3159,17 +3597,17 @@ EXPECT_FALSE(LHS >= RHS); }; Relation Relations[NumVals][NumVals] = { - // -N -I -B -1 -0 +0 +1 +B +I +N - /* MNan */ {UN, UN, UN, UN, UN, UN, UN, UN, UN, UN}, - /* MInf */ {UN, EQ, LT, LT, LT, LT, LT, LT, LT, UN}, - /* MBig */ {UN, GT, EQ, LT, LT, LT, LT, LT, LT, UN}, - /* MOne */ {UN, GT, GT, EQ, LT, LT, LT, LT, LT, UN}, - /* MZer */ {UN, GT, GT, GT, EQ, EQ, LT, LT, LT, UN}, - /* PZer */ {UN, GT, GT, GT, EQ, EQ, LT, LT, LT, UN}, - /* POne */ {UN, GT, GT, GT, GT, GT, EQ, LT, LT, UN}, - /* PBig */ {UN, GT, GT, GT, GT, GT, GT, EQ, LT, UN}, - /* PInf */ {UN, GT, GT, GT, GT, GT, GT, GT, EQ, UN}, - /* PNan */ {UN, UN, UN, UN, UN, UN, UN, UN, UN, UN}, + // -N -I -B -1 -0 +0 +1 +B +I +N + /* MNan */ {UN, UN, UN, UN, UN, UN, UN, UN, UN, UN}, + /* MInf */ {UN, EQ, LT, LT, LT, LT, LT, LT, LT, UN}, + /* MBig */ {UN, GT, EQ, LT, LT, LT, LT, LT, LT, UN}, + /* MOne */ {UN, GT, GT, EQ, LT, LT, LT, LT, LT, UN}, + /* MZer */ {UN, GT, GT, GT, EQ, EQ, LT, LT, LT, UN}, + /* PZer */ {UN, GT, GT, GT, EQ, EQ, LT, LT, LT, UN}, + /* POne */ {UN, GT, GT, GT, GT, GT, EQ, LT, LT, UN}, + /* PBig */ {UN, GT, GT, GT, GT, GT, GT, EQ, LT, UN}, + /* PInf */ {UN, GT, GT, GT, GT, GT, GT, GT, EQ, UN}, + /* PNan */ {UN, UN, UN, UN, UN, UN, UN, UN, UN, UN}, }; for (unsigned I = 0; I < NumVals; ++I) for (unsigned J = 0; J < NumVals; ++J) @@ -3192,9 +3630,9 @@ APFloat PSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), false); APFloat MSmallestValue = APFloat::getSmallest(APFloat::IEEEsingle(), true); APFloat PSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); APFloat MSmallestNormalized = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); EXPECT_TRUE(PInf.bitwiseIsEqual(abs(PInf))); EXPECT_TRUE(PInf.bitwiseIsEqual(abs(MInf))); @@ -3250,17 +3688,20 @@ TEST(APFloatTest, ilogb) { EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble(), false))); EXPECT_EQ(-1074, ilogb(APFloat::getSmallest(APFloat::IEEEdouble(), true))); - EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1024"))); - EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023"))); - EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023"))); + EXPECT_EQ(-1023, + ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1024"))); + EXPECT_EQ(-1023, + ilogb(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023"))); + EXPECT_EQ(-1023, + ilogb(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023"))); EXPECT_EQ(-51, ilogb(APFloat(APFloat::IEEEdouble(), "0x1p-51"))); - EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1023"))); + EXPECT_EQ(-1023, + ilogb(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1023"))); EXPECT_EQ(-2, ilogb(APFloat(APFloat::IEEEdouble(), "0x0.ffffp-1"))); EXPECT_EQ(-1023, ilogb(APFloat(APFloat::IEEEdouble(), "0x1.fffep-1023"))); EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble(), false))); EXPECT_EQ(1023, ilogb(APFloat::getLargest(APFloat::IEEEdouble(), true))); - EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle(), "0x1p+0"))); EXPECT_EQ(0, ilogb(APFloat(APFloat::IEEEsingle(), "-0x1p+0"))); EXPECT_EQ(42, ilogb(APFloat(APFloat::IEEEsingle(), "0x1p+42"))); @@ -3284,8 +3725,8 @@ EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle(), false))); EXPECT_EQ(-149, ilogb(APFloat::getSmallest(APFloat::IEEEsingle(), true))); - EXPECT_EQ(-126, - ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false))); + EXPECT_EQ(-126, ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle(), + false))); EXPECT_EQ(-126, ilogb(APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true))); } @@ -3293,15 +3734,15 @@ TEST(APFloatTest, scalbn) { const APFloat::roundingMode RM = APFloat::rmNearestTiesToEven; - EXPECT_TRUE( - APFloat(APFloat::IEEEsingle(), "0x1p+0") - .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 0, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEsingle(), "0x1p+42") - .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 42, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEsingle(), "0x1p-42") - .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), -42, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p+0") + .bitwiseIsEqual( + scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 0, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p+42") + .bitwiseIsEqual(scalbn( + APFloat(APFloat::IEEEsingle(), "0x1p+0"), 42, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "0x1p-42") + .bitwiseIsEqual(scalbn( + APFloat(APFloat::IEEEsingle(), "0x1p+0"), -42, RM))); APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false); APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true); @@ -3323,32 +3764,30 @@ EXPECT_TRUE(ScalbnSNaN.isNaN() && !ScalbnSNaN.isSignaling()); // Make sure highest bit of payload is preserved. - const APInt Payload(64, (UINT64_C(1) << 50) | - (UINT64_C(1) << 49) | - (UINT64_C(1234) << 32) | - 1); + const APInt Payload(64, (UINT64_C(1) << 50) | (UINT64_C(1) << 49) | + (UINT64_C(1234) << 32) | 1); - APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble(), false, - &Payload); + APFloat SNaNWithPayload = + APFloat::getSNaN(APFloat::IEEEdouble(), false, &Payload); APFloat QuietPayload = scalbn(SNaNWithPayload, 1, RM); EXPECT_TRUE(QuietPayload.isNaN() && !QuietPayload.isSignaling()); EXPECT_EQ(Payload, QuietPayload.bitcastToAPInt().getLoBits(51)); EXPECT_TRUE(PInf.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 128, RM))); + scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+0"), 128, RM))); EXPECT_TRUE(MInf.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p+0"), 128, RM))); + scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p+0"), 128, RM))); EXPECT_TRUE(PInf.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+127"), 1, RM))); + scalbn(APFloat(APFloat::IEEEsingle(), "0x1p+127"), 1, RM))); EXPECT_TRUE(PZero.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-127"), -127, RM))); + scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-127"), -127, RM))); EXPECT_TRUE(MZero.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -127, RM))); - EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "-0x1p-149").bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -22, RM))); + scalbn(APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -127, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEsingle(), "-0x1p-149") + .bitwiseIsEqual(scalbn( + APFloat(APFloat::IEEEsingle(), "-0x1p-127"), -22, RM))); EXPECT_TRUE(PZero.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-126"), -24, RM))); - + scalbn(APFloat(APFloat::IEEEsingle(), "0x1p-126"), -24, RM))); APFloat SmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble(), false); APFloat NegSmallestF64 = APFloat::getSmallest(APFloat::IEEEdouble(), true); @@ -3356,30 +3795,30 @@ APFloat LargestF64 = APFloat::getLargest(APFloat::IEEEdouble(), false); APFloat NegLargestF64 = APFloat::getLargest(APFloat::IEEEdouble(), true); - APFloat SmallestNormalizedF64 - = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); - APFloat NegSmallestNormalizedF64 - = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); + APFloat SmallestNormalizedF64 = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); + APFloat NegSmallestNormalizedF64 = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); APFloat LargestDenormalF64(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1023"); - APFloat NegLargestDenormalF64(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1023"); - + APFloat NegLargestDenormalF64(APFloat::IEEEdouble(), + "-0x1.ffffffffffffep-1023"); EXPECT_TRUE(SmallestF64.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEdouble(), "0x1p-1074"), 0, RM))); + scalbn(APFloat(APFloat::IEEEdouble(), "0x1p-1074"), 0, RM))); EXPECT_TRUE(NegSmallestF64.bitwiseIsEqual( - scalbn(APFloat(APFloat::IEEEdouble(), "-0x1p-1074"), 0, RM))); + scalbn(APFloat(APFloat::IEEEdouble(), "-0x1p-1074"), 0, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1023") - .bitwiseIsEqual(scalbn(SmallestF64, 2097, RM))); + .bitwiseIsEqual(scalbn(SmallestF64, 2097, RM))); EXPECT_TRUE(scalbn(SmallestF64, -2097, RM).isPosZero()); EXPECT_TRUE(scalbn(SmallestF64, -2098, RM).isPosZero()); EXPECT_TRUE(scalbn(SmallestF64, -2099, RM).isPosZero()); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1022") - .bitwiseIsEqual(scalbn(SmallestF64, 2096, RM))); + .bitwiseIsEqual(scalbn(SmallestF64, 2096, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+1023") - .bitwiseIsEqual(scalbn(SmallestF64, 2097, RM))); + .bitwiseIsEqual(scalbn(SmallestF64, 2097, RM))); EXPECT_TRUE(scalbn(SmallestF64, 2098, RM).isInfinity()); EXPECT_TRUE(scalbn(SmallestF64, 2099, RM).isInfinity()); @@ -3387,18 +3826,18 @@ EXPECT_TRUE(scalbn(SmallestF64, -INT_MAX, RM).isPosZero()); EXPECT_TRUE(scalbn(LargestF64, INT_MAX, RM).isInfinity()); - EXPECT_TRUE(LargestDenormalF64 - .bitwiseIsEqual(scalbn(LargestDenormalF64, 0, RM))); - EXPECT_TRUE(NegLargestDenormalF64 - .bitwiseIsEqual(scalbn(NegLargestDenormalF64, 0, RM))); + EXPECT_TRUE( + LargestDenormalF64.bitwiseIsEqual(scalbn(LargestDenormalF64, 0, RM))); + EXPECT_TRUE(NegLargestDenormalF64.bitwiseIsEqual( + scalbn(NegLargestDenormalF64, 0, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1022") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 1, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 1, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1021") - .bitwiseIsEqual(scalbn(NegLargestDenormalF64, 2, RM))); + .bitwiseIsEqual(scalbn(NegLargestDenormalF64, 2, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+1") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 1024, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 1024, RM))); EXPECT_TRUE(scalbn(LargestDenormalF64, -1023, RM).isPosZero()); EXPECT_TRUE(scalbn(LargestDenormalF64, -1024, RM).isPosZero()); EXPECT_TRUE(scalbn(LargestDenormalF64, -2048, RM).isPosZero()); @@ -3407,58 +3846,52 @@ EXPECT_TRUE(scalbn(LargestDenormalF64, 2099, RM).isInfinity()); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-2") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 1021, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 1021, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 1022, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 1022, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+0") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 1023, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 1023, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep+1023") - .bitwiseIsEqual(scalbn(LargestDenormalF64, 2046, RM))); + .bitwiseIsEqual(scalbn(LargestDenormalF64, 2046, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+974") - .bitwiseIsEqual(scalbn(SmallestF64, 2048, RM))); + .bitwiseIsEqual(scalbn(SmallestF64, 2048, RM))); APFloat RandomDenormalF64(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+51"); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-972") - .bitwiseIsEqual(scalbn(RandomDenormalF64, -1023, RM))); + .bitwiseIsEqual(scalbn(RandomDenormalF64, -1023, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1") - .bitwiseIsEqual(scalbn(RandomDenormalF64, -52, RM))); + .bitwiseIsEqual(scalbn(RandomDenormalF64, -52, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-2") - .bitwiseIsEqual(scalbn(RandomDenormalF64, -53, RM))); + .bitwiseIsEqual(scalbn(RandomDenormalF64, -53, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+0") - .bitwiseIsEqual(scalbn(RandomDenormalF64, -51, RM))); + .bitwiseIsEqual(scalbn(RandomDenormalF64, -51, RM))); EXPECT_TRUE(scalbn(RandomDenormalF64, -2097, RM).isPosZero()); EXPECT_TRUE(scalbn(RandomDenormalF64, -2090, RM).isPosZero()); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1073") + .bitwiseIsEqual(scalbn(NegLargestF64, -2097, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "-0x1p-1073") - .bitwiseIsEqual(scalbn(NegLargestF64, -2097, RM))); - - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "-0x1p-1024") - .bitwiseIsEqual(scalbn(NegLargestF64, -2048, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1024") + .bitwiseIsEqual(scalbn(NegLargestF64, -2048, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "0x1p-1073") - .bitwiseIsEqual(scalbn(LargestF64, -2097, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1073") + .bitwiseIsEqual(scalbn(LargestF64, -2097, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "0x1p-1074") - .bitwiseIsEqual(scalbn(LargestF64, -2098, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1074") + .bitwiseIsEqual(scalbn(LargestF64, -2098, RM))); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1074") - .bitwiseIsEqual(scalbn(NegLargestF64, -2098, RM))); + .bitwiseIsEqual(scalbn(NegLargestF64, -2098, RM))); EXPECT_TRUE(scalbn(NegLargestF64, -2099, RM).isNegZero()); EXPECT_TRUE(scalbn(LargestF64, 1, RM).isInfinity()); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p+0") + .bitwiseIsEqual(scalbn( + APFloat(APFloat::IEEEdouble(), "0x1p+52"), -52, RM))); - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "0x1p+0") - .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble(), "0x1p+52"), -52, RM))); - - EXPECT_TRUE( - APFloat(APFloat::IEEEdouble(), "0x1p-103") - .bitwiseIsEqual(scalbn(APFloat(APFloat::IEEEdouble(), "0x1p-51"), -52, RM))); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-103") + .bitwiseIsEqual(scalbn( + APFloat(APFloat::IEEEdouble(), "0x1p-51"), -52, RM))); } TEST(APFloatTest, frexp) { @@ -3488,23 +3921,20 @@ APFloat SNaN = APFloat::getSNaN(APFloat::IEEEdouble(), false); // Make sure highest bit of payload is preserved. - const APInt Payload(64, (UINT64_C(1) << 50) | - (UINT64_C(1) << 49) | - (UINT64_C(1234) << 32) | - 1); + const APInt Payload(64, (UINT64_C(1) << 50) | (UINT64_C(1) << 49) | + (UINT64_C(1234) << 32) | 1); - APFloat SNaNWithPayload = APFloat::getSNaN(APFloat::IEEEdouble(), false, - &Payload); + APFloat SNaNWithPayload = + APFloat::getSNaN(APFloat::IEEEdouble(), false, &Payload); - APFloat SmallestNormalized - = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); - APFloat NegSmallestNormalized - = APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); + APFloat SmallestNormalized = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); + APFloat NegSmallestNormalized = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); int Exp; APFloat Frac(APFloat::IEEEdouble()); - Frac = frexp(PZero, Exp, RM); EXPECT_EQ(0, Exp); EXPECT_TRUE(Frac.isPosZero()); @@ -3513,7 +3943,6 @@ EXPECT_EQ(0, Exp); EXPECT_TRUE(Frac.isNegZero()); - Frac = frexp(One, Exp, RM); EXPECT_EQ(1, Exp); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1").bitwiseIsEqual(Frac)); @@ -3524,12 +3953,13 @@ Frac = frexp(LargestDenormal, Exp, RM); EXPECT_EQ(-1022, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1").bitwiseIsEqual(Frac)); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.ffffffffffffep-1") + .bitwiseIsEqual(Frac)); Frac = frexp(NegLargestDenormal, Exp, RM); EXPECT_EQ(-1022, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1").bitwiseIsEqual(Frac)); - + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.ffffffffffffep-1") + .bitwiseIsEqual(Frac)); Frac = frexp(Smallest, Exp, RM); EXPECT_EQ(-1073, Exp); @@ -3539,15 +3969,15 @@ EXPECT_EQ(-1073, Exp); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1p-1").bitwiseIsEqual(Frac)); - Frac = frexp(Largest, Exp, RM); EXPECT_EQ(1024, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.fffffffffffffp-1").bitwiseIsEqual(Frac)); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.fffffffffffffp-1") + .bitwiseIsEqual(Frac)); Frac = frexp(NegLargest, Exp, RM); EXPECT_EQ(1024, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.fffffffffffffp-1").bitwiseIsEqual(Frac)); - + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "-0x1.fffffffffffffp-1") + .bitwiseIsEqual(Frac)); Frac = frexp(PInf, Exp, RM); EXPECT_EQ(INT_MAX, Exp); @@ -3576,15 +4006,18 @@ Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x0.ffffp-1"), Exp, RM); EXPECT_EQ(-1, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.fffep-1").bitwiseIsEqual(Frac)); + EXPECT_TRUE( + APFloat(APFloat::IEEEdouble(), "0x1.fffep-1").bitwiseIsEqual(Frac)); Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x1p-51"), Exp, RM); EXPECT_EQ(-50, Exp); EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1p-1").bitwiseIsEqual(Frac)); - Frac = frexp(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+51"), Exp, RM); + Frac = + frexp(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp+51"), Exp, RM); EXPECT_EQ(52, Exp); - EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1").bitwiseIsEqual(Frac)); + EXPECT_TRUE(APFloat(APFloat::IEEEdouble(), "0x1.c60f120d9f87cp-1") + .bitwiseIsEqual(Frac)); } TEST(APFloatTest, mod) { @@ -3705,347 +4138,401 @@ int status; int category; } SpecialCaseTests[] = { - { PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PInf, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MInf, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, - { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PInf, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MInf, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, PLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, MLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PNormalValue, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, PInf, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MInf, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MNormalValue, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, PLargestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, MLargestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MNormalValue, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PInf, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, MInf, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PLargestValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PLargestValue, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PInf, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, MInf, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MLargestValue, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MLargestValue, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, PInf, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MInf, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PLargestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MLargestValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestValue, PSmallestNormalized, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, MSmallestNormalized, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PInf, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MInf, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PLargestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MLargestValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestValue, PSmallestNormalized, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, MSmallestNormalized, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PInf, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MInf, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PLargestValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, MLargestValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, PInf, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MInf, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, - { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, - { MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PLargestValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, MLargestValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MSmallestNormalized, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - - { PVal1, PVal1, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, MVal1, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, PVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, MVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, PVal4, "-0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { PVal1, MVal4, "-0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { PVal1, PVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, MVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal1, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, PVal1, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, MVal1, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, PVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, MVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, PVal4, "0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { MVal1, MVal4, "0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { MVal1, PVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, MVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal1, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal2, PVal1, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, MVal1, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, PVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal2, MVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal2, PVal3, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, MVal3, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, PVal4, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, MVal4, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, PVal5, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, MVal5, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, PVal6, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal2, MVal6, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, PVal1, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, MVal1, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, PVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal2, MVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal2, PVal3, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, MVal3, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, PVal4, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, MVal4, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, PVal5, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, MVal5, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, PVal6, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { MVal2, MVal6, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal }, - { PVal3, PVal1, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, MVal1, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, PVal2, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal3, MVal2, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal3, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal3, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal3, PVal4, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, MVal4, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, PVal5, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, MVal5, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, PVal6, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal3, MVal6, "0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, PVal1, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, MVal1, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, PVal2, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal3, MVal2, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal3, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal3, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal3, PVal4, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, MVal4, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, PVal5, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, MVal5, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, PVal6, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { MVal3, MVal6, "-0x1p-125", APFloat::opOK, APFloat::fcNormal }, - { PVal4, PVal1, "0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { PVal4, MVal1, "0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { PVal4, PVal2, "0x0.002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal4, MVal2, "0x0.002p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal4, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal4, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal4, PVal4, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal4, MVal4, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal4, PVal5, "0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal4, MVal5, "0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal4, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal4, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, PVal1, "-0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { MVal4, MVal1, "-0x1p+103", APFloat::opOK, APFloat::fcNormal }, - { MVal4, PVal2, "-0x0.002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal4, MVal2, "-0x0.002p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal4, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, PVal4, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, MVal4, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, PVal5, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal4, MVal5, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal4, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal4, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal5, PVal1, "1.5", APFloat::opOK, APFloat::fcNormal }, - { PVal5, MVal1, "1.5", APFloat::opOK, APFloat::fcNormal }, - { PVal5, PVal2, "0x0.00006p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal5, MVal2, "0x0.00006p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal5, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal5, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal5, PVal4, "1.5", APFloat::opOK, APFloat::fcNormal }, - { PVal5, MVal4, "1.5", APFloat::opOK, APFloat::fcNormal }, - { PVal5, PVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal5, MVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal5, PVal6, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal5, MVal6, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, PVal1, "-1.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, MVal1, "-1.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, PVal2, "-0x0.00006p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal5, MVal2, "-0x0.00006p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal5, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal5, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal5, PVal4, "-1.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, MVal4, "-1.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, PVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal5, MVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal5, PVal6, "0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal5, MVal6, "0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal6, PVal1, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PVal6, MVal1, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PVal6, PVal2, "0x0.00004p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal6, MVal2, "0x0.00004p-126", APFloat::opOK, APFloat::fcNormal }, - { PVal6, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal6, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal6, PVal4, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PVal6, MVal4, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PVal6, PVal5, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal6, MVal5, "-0.5", APFloat::opOK, APFloat::fcNormal }, - { PVal6, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PVal6, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal6, PVal1, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MVal6, MVal1, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MVal6, PVal2, "-0x0.00004p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal6, MVal2, "-0x0.00004p-126", APFloat::opOK, APFloat::fcNormal }, - { MVal6, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal6, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal6, PVal4, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MVal6, MVal4, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MVal6, PVal5, "0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal6, MVal5, "0.5", APFloat::opOK, APFloat::fcNormal }, - { MVal6, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MVal6, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, + {PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PInf, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MInf, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MInf, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, PSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PZero, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, PSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MZero, MSmallestNormalized, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {QNaN, PInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MInf, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MLargestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN}, + {SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PNormalValue, PInf, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MInf, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, PLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, MLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PNormalValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PNormalValue, PSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PNormalValue, MSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MNormalValue, PInf, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, MInf, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MNormalValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MNormalValue, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, PLargestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, MLargestValue, "-0x1p+0", APFloat::opOK, + APFloat::fcNormal}, + {MNormalValue, PSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, MSmallestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MNormalValue, PSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MNormalValue, MSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PLargestValue, PInf, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, MInf, "0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {PLargestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PLargestValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, PSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, MSmallestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PLargestValue, PSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PLargestValue, MSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MLargestValue, PInf, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, MInf, "-0x1.fffffep+127", APFloat::opOK, + APFloat::fcNormal}, + {MLargestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MLargestValue, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, MLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MLargestValue, PSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MLargestValue, MSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MLargestValue, PSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MLargestValue, MSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestValue, PInf, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, MInf, "0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {PSmallestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PLargestValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MLargestValue, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, PSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestValue, MSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestValue, PSmallestNormalized, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestValue, MSmallestNormalized, "0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PInf, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, MInf, "-0x1p-149", APFloat::opOK, APFloat::fcNormal}, + {MSmallestValue, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PLargestValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MLargestValue, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, PSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestValue, MSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestValue, PSmallestNormalized, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestValue, MSmallestNormalized, "-0x1p-149", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PInf, "0x1p-126", APFloat::opOK, APFloat::fcNormal}, + {PSmallestNormalized, MInf, "0x1p-126", APFloat::opOK, APFloat::fcNormal}, + {PSmallestNormalized, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestNormalized, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PLargestValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, MLargestValue, "0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {PSmallestNormalized, PSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestNormalized, MSmallestValue, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestNormalized, PSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {PSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, PInf, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MInf, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestNormalized, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN}, + {MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN}, + {MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, + APFloat::fcNaN}, + {MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PLargestValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, MLargestValue, "-0x1p-126", APFloat::opOK, + APFloat::fcNormal}, + {MSmallestNormalized, PSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, MSmallestValue, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, PSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + {MSmallestNormalized, MSmallestNormalized, "-0x0p+0", APFloat::opOK, + APFloat::fcZero}, + + {PVal1, PVal1, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, MVal1, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, PVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, MVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, PVal4, "-0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {PVal1, MVal4, "-0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {PVal1, PVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, MVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal1, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, PVal1, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, MVal1, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, PVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, MVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, PVal4, "0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {MVal1, MVal4, "0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {MVal1, PVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, MVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal1, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal2, PVal1, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, MVal1, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, PVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal2, MVal2, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal2, PVal3, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, MVal3, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, PVal4, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, MVal4, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, PVal5, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, MVal5, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, PVal6, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal2, MVal6, "0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, PVal1, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, MVal1, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, PVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal2, MVal2, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal2, PVal3, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, MVal3, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, PVal4, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, MVal4, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, PVal5, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, MVal5, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, PVal6, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {MVal2, MVal6, "-0x1.fffffep-126", APFloat::opOK, APFloat::fcNormal}, + {PVal3, PVal1, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, MVal1, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, PVal2, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal3, MVal2, "0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal3, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal3, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal3, PVal4, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, MVal4, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, PVal5, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, MVal5, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, PVal6, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal3, MVal6, "0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, PVal1, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, MVal1, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, PVal2, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal3, MVal2, "-0x0.000002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal3, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal3, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal3, PVal4, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, MVal4, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, PVal5, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, MVal5, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, PVal6, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {MVal3, MVal6, "-0x1p-125", APFloat::opOK, APFloat::fcNormal}, + {PVal4, PVal1, "0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {PVal4, MVal1, "0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {PVal4, PVal2, "0x0.002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal4, MVal2, "0x0.002p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal4, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal4, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal4, PVal4, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal4, MVal4, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal4, PVal5, "0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal4, MVal5, "0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal4, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal4, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, PVal1, "-0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {MVal4, MVal1, "-0x1p+103", APFloat::opOK, APFloat::fcNormal}, + {MVal4, PVal2, "-0x0.002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal4, MVal2, "-0x0.002p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal4, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, PVal4, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, MVal4, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, PVal5, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal4, MVal5, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal4, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal4, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal5, PVal1, "1.5", APFloat::opOK, APFloat::fcNormal}, + {PVal5, MVal1, "1.5", APFloat::opOK, APFloat::fcNormal}, + {PVal5, PVal2, "0x0.00006p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal5, MVal2, "0x0.00006p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal5, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal5, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal5, PVal4, "1.5", APFloat::opOK, APFloat::fcNormal}, + {PVal5, MVal4, "1.5", APFloat::opOK, APFloat::fcNormal}, + {PVal5, PVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal5, MVal5, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal5, PVal6, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal5, MVal6, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, PVal1, "-1.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, MVal1, "-1.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, PVal2, "-0x0.00006p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal5, MVal2, "-0x0.00006p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal5, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal5, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal5, PVal4, "-1.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, MVal4, "-1.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, PVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal5, MVal5, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal5, PVal6, "0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal5, MVal6, "0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal6, PVal1, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PVal6, MVal1, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PVal6, PVal2, "0x0.00004p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal6, MVal2, "0x0.00004p-126", APFloat::opOK, APFloat::fcNormal}, + {PVal6, PVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal6, MVal3, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal6, PVal4, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PVal6, MVal4, "0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {PVal6, PVal5, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal6, MVal5, "-0.5", APFloat::opOK, APFloat::fcNormal}, + {PVal6, PVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {PVal6, MVal6, "0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal6, PVal1, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MVal6, MVal1, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MVal6, PVal2, "-0x0.00004p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal6, MVal2, "-0x0.00004p-126", APFloat::opOK, APFloat::fcNormal}, + {MVal6, PVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal6, MVal3, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal6, PVal4, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MVal6, MVal4, "-0x1p+0", APFloat::opOK, APFloat::fcNormal}, + {MVal6, PVal5, "0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal6, MVal5, "0.5", APFloat::opOK, APFloat::fcNormal}, + {MVal6, PVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, + {MVal6, MVal6, "-0x0p+0", APFloat::opOK, APFloat::fcZero}, }; for (size_t i = 0; i < std::size(SpecialCaseTests); ++i) { @@ -4618,7 +5105,8 @@ TEST(APFloatTest, PPCDoubleDoubleChangeSign) { uint64_t Data[] = { - 0x400f000000000000ull, 0xbcb0000000000000ull, + 0x400f000000000000ull, + 0xbcb0000000000000ull, }; APFloat Float(APFloat::PPCDoubleDouble(), APInt(128, 2, Data)); { @@ -4638,21 +5126,24 @@ TEST(APFloatTest, PPCDoubleDoubleFactories) { { uint64_t Data[] = { - 0, 0, + 0, + 0, }; EXPECT_EQ(APInt(128, 2, Data), APFloat::getZero(APFloat::PPCDoubleDouble()).bitcastToAPInt()); } { uint64_t Data[] = { - 0x7fefffffffffffffull, 0x7c8ffffffffffffeull, + 0x7fefffffffffffffull, + 0x7c8ffffffffffffeull, }; EXPECT_EQ(APInt(128, 2, Data), APFloat::getLargest(APFloat::PPCDoubleDouble()).bitcastToAPInt()); } { uint64_t Data[] = { - 0x0000000000000001ull, 0, + 0x0000000000000001ull, + 0, }; EXPECT_EQ( APInt(128, 2, Data), @@ -4666,7 +5157,8 @@ } { uint64_t Data[] = { - 0x8000000000000000ull, 0x0000000000000000ull, + 0x8000000000000000ull, + 0x0000000000000000ull, }; EXPECT_EQ( APInt(128, 2, Data), @@ -4674,7 +5166,8 @@ } { uint64_t Data[] = { - 0xffefffffffffffffull, 0xfc8ffffffffffffeull, + 0xffefffffffffffffull, + 0xfc8ffffffffffffeull, }; EXPECT_EQ( APInt(128, 2, Data), @@ -4682,7 +5175,8 @@ } { uint64_t Data[] = { - 0x8000000000000001ull, 0x0000000000000000ull, + 0x8000000000000001ull, + 0x0000000000000000ull, }; EXPECT_EQ(APInt(128, 2, Data), APFloat::getSmallest(APFloat::PPCDoubleDouble(), true) @@ -4690,7 +5184,8 @@ } { uint64_t Data[] = { - 0x8360000000000000ull, 0x0000000000000000ull, + 0x8360000000000000ull, + 0x0000000000000000ull, }; EXPECT_EQ(APInt(128, 2, Data), APFloat::getSmallestNormalized(APFloat::PPCDoubleDouble(), true) @@ -4708,7 +5203,8 @@ { // (4 + 3) is not normalized uint64_t Data[] = { - 0x4010000000000000ull, 0x4008000000000000ull, + 0x4010000000000000ull, + 0x4008000000000000ull, }; EXPECT_TRUE( APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Data)).isDenormal()); @@ -4718,7 +5214,8 @@ TEST(APFloatTest, PPCDoubleDoubleScalbn) { // 3.0 + 3.0 << 53 uint64_t Input[] = { - 0x4008000000000000ull, 0x3cb8000000000000ull, + 0x4008000000000000ull, + 0x3cb8000000000000ull, }; APFloat Result = scalbn(APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Input)), 1, @@ -4731,7 +5228,8 @@ TEST(APFloatTest, PPCDoubleDoubleFrexp) { // 3.0 + 3.0 << 53 uint64_t Input[] = { - 0x4008000000000000ull, 0x3cb8000000000000ull, + 0x4008000000000000ull, + 0x3cb8000000000000ull, }; int Exp; // 0.75 + 0.75 << 53 @@ -4755,257 +5253,361 @@ } TEST(APFloatTest, ToDouble) { - APFloat DPosZero(0.0); - APFloat DPosZeroToDouble(DPosZero.convertToDouble()); - EXPECT_TRUE(DPosZeroToDouble.isPosZero()); - APFloat DNegZero(-0.0); - APFloat DNegZeroToDouble(DNegZero.convertToDouble()); - EXPECT_TRUE(DNegZeroToDouble.isNegZero()); - - APFloat DOne(1.0); - EXPECT_EQ(1.0, DOne.convertToDouble()); - APFloat DPosLargest = APFloat::getLargest(APFloat::IEEEdouble(), false); - EXPECT_EQ(std::numeric_limits::max(), DPosLargest.convertToDouble()); - APFloat DNegLargest = APFloat::getLargest(APFloat::IEEEdouble(), true); - EXPECT_EQ(-std::numeric_limits::max(), DNegLargest.convertToDouble()); - APFloat DPosSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); - EXPECT_EQ(std::numeric_limits::min(), DPosSmallest.convertToDouble()); - APFloat DNegSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); - EXPECT_EQ(-std::numeric_limits::min(), - DNegSmallest.convertToDouble()); - - APFloat DSmallestDenorm = APFloat::getSmallest(APFloat::IEEEdouble(), false); - EXPECT_EQ(std::numeric_limits::denorm_min(), - DSmallestDenorm.convertToDouble()); - APFloat DLargestDenorm(APFloat::IEEEdouble(), "0x0.FFFFFFFFFFFFFp-1022"); - EXPECT_EQ(/*0x0.FFFFFFFFFFFFFp-1022*/ 2.225073858507201e-308, - DLargestDenorm.convertToDouble()); - - APFloat DPosInf = APFloat::getInf(APFloat::IEEEdouble()); - EXPECT_EQ(std::numeric_limits::infinity(), DPosInf.convertToDouble()); - APFloat DNegInf = APFloat::getInf(APFloat::IEEEdouble(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), - DNegInf.convertToDouble()); - APFloat DQNaN = APFloat::getQNaN(APFloat::IEEEdouble()); - EXPECT_TRUE(std::isnan(DQNaN.convertToDouble())); - - APFloat FPosZero(0.0F); - APFloat FPosZeroToDouble(FPosZero.convertToDouble()); - EXPECT_TRUE(FPosZeroToDouble.isPosZero()); - APFloat FNegZero(-0.0F); - APFloat FNegZeroToDouble(FNegZero.convertToDouble()); - EXPECT_TRUE(FNegZeroToDouble.isNegZero()); - - APFloat FOne(1.0F); - EXPECT_EQ(1.0, FOne.convertToDouble()); - APFloat FPosLargest = APFloat::getLargest(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::max(), FPosLargest.convertToDouble()); - APFloat FNegLargest = APFloat::getLargest(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::max(), FNegLargest.convertToDouble()); - APFloat FPosSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::min(), FPosSmallest.convertToDouble()); - APFloat FNegSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::min(), FNegSmallest.convertToDouble()); - - APFloat FSmallestDenorm = APFloat::getSmallest(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::denorm_min(), - FSmallestDenorm.convertToDouble()); - APFloat FLargestDenorm(APFloat::IEEEdouble(), "0x0.FFFFFEp-126"); - EXPECT_EQ(/*0x0.FFFFFEp-126*/ 1.1754942106924411e-38, - FLargestDenorm.convertToDouble()); - - APFloat FPosInf = APFloat::getInf(APFloat::IEEEsingle()); - EXPECT_EQ(std::numeric_limits::infinity(), FPosInf.convertToDouble()); - APFloat FNegInf = APFloat::getInf(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), - FNegInf.convertToDouble()); - APFloat FQNaN = APFloat::getQNaN(APFloat::IEEEsingle()); - EXPECT_TRUE(std::isnan(FQNaN.convertToDouble())); - - APFloat HPosZero = APFloat::getZero(APFloat::IEEEhalf()); - APFloat HPosZeroToDouble(HPosZero.convertToDouble()); - EXPECT_TRUE(HPosZeroToDouble.isPosZero()); - APFloat HNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); - APFloat HNegZeroToDouble(HNegZero.convertToDouble()); - EXPECT_TRUE(HNegZeroToDouble.isNegZero()); - - APFloat HOne(APFloat::IEEEhalf(), "1.0"); - EXPECT_EQ(1.0, HOne.convertToDouble()); - APFloat HPosLargest = APFloat::getLargest(APFloat::IEEEhalf(), false); - EXPECT_EQ(65504.0, HPosLargest.convertToDouble()); - APFloat HNegLargest = APFloat::getLargest(APFloat::IEEEhalf(), true); - EXPECT_EQ(-65504.0, HNegLargest.convertToDouble()); - APFloat HPosSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEhalf(), false); - EXPECT_EQ(/*0x1.p-14*/ 6.103515625e-05, HPosSmallest.convertToDouble()); - APFloat HNegSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEhalf(), true); - EXPECT_EQ(/*-0x1.p-14*/ -6.103515625e-05, HNegSmallest.convertToDouble()); - - APFloat HSmallestDenorm = APFloat::getSmallest(APFloat::IEEEhalf(), false); - EXPECT_EQ(/*0x1.p-24*/ 5.960464477539063e-08, - HSmallestDenorm.convertToDouble()); - APFloat HLargestDenorm(APFloat::IEEEhalf(), "0x1.FFCp-14"); - EXPECT_EQ(/*0x1.FFCp-14*/ 0.00012201070785522461, - HLargestDenorm.convertToDouble()); - - APFloat HPosInf = APFloat::getInf(APFloat::IEEEhalf()); - EXPECT_EQ(std::numeric_limits::infinity(), HPosInf.convertToDouble()); - APFloat HNegInf = APFloat::getInf(APFloat::IEEEhalf(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), - HNegInf.convertToDouble()); - APFloat HQNaN = APFloat::getQNaN(APFloat::IEEEhalf()); - EXPECT_TRUE(std::isnan(HQNaN.convertToDouble())); - - APFloat BPosZero = APFloat::getZero(APFloat::IEEEhalf()); - APFloat BPosZeroToDouble(BPosZero.convertToDouble()); - EXPECT_TRUE(BPosZeroToDouble.isPosZero()); - APFloat BNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); - APFloat BNegZeroToDouble(BNegZero.convertToDouble()); - EXPECT_TRUE(BNegZeroToDouble.isNegZero()); - - APFloat BOne(APFloat::BFloat(), "1.0"); - EXPECT_EQ(1.0, BOne.convertToDouble()); - APFloat BPosLargest = APFloat::getLargest(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.FEp127*/ 3.3895313892515355e+38, - BPosLargest.convertToDouble()); - APFloat BNegLargest = APFloat::getLargest(APFloat::BFloat(), true); - EXPECT_EQ(/*-0x1.FEp127*/ -3.3895313892515355e+38, - BNegLargest.convertToDouble()); - APFloat BPosSmallest = - APFloat::getSmallestNormalized(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.p-126*/ 1.1754943508222875e-38, - BPosSmallest.convertToDouble()); - APFloat BNegSmallest = - APFloat::getSmallestNormalized(APFloat::BFloat(), true); - EXPECT_EQ(/*-0x1.p-126*/ -1.1754943508222875e-38, - BNegSmallest.convertToDouble()); - - APFloat BSmallestDenorm = APFloat::getSmallest(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.p-133*/ 9.183549615799121e-41, - BSmallestDenorm.convertToDouble()); - APFloat BLargestDenorm(APFloat::BFloat(), "0x1.FCp-127"); - EXPECT_EQ(/*0x1.FCp-127*/ 1.1663108012064884e-38, - BLargestDenorm.convertToDouble()); - - APFloat BPosInf = APFloat::getInf(APFloat::BFloat()); - EXPECT_EQ(std::numeric_limits::infinity(), BPosInf.convertToDouble()); - APFloat BNegInf = APFloat::getInf(APFloat::BFloat(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), - BNegInf.convertToDouble()); - APFloat BQNaN = APFloat::getQNaN(APFloat::BFloat()); - EXPECT_TRUE(std::isnan(BQNaN.convertToDouble())); + // IEEEdouble + { + APFloat DPosZero(0.0); + APFloat DPosZeroToDouble(DPosZero.convertToDouble()); + EXPECT_TRUE(DPosZeroToDouble.isPosZero()); + APFloat DNegZero(-0.0); + APFloat DNegZeroToDouble(DNegZero.convertToDouble()); + EXPECT_TRUE(DNegZeroToDouble.isNegZero()); + + APFloat DOne(1.0); + EXPECT_EQ(1.0, DOne.convertToDouble()); + APFloat DPosLargest = APFloat::getLargest(APFloat::IEEEdouble(), false); + EXPECT_EQ(std::numeric_limits::max(), + DPosLargest.convertToDouble()); + APFloat DNegLargest = APFloat::getLargest(APFloat::IEEEdouble(), true); + EXPECT_EQ(-std::numeric_limits::max(), + DNegLargest.convertToDouble()); + APFloat DPosSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), false); + EXPECT_EQ(std::numeric_limits::min(), + DPosSmallest.convertToDouble()); + APFloat DNegSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEdouble(), true); + EXPECT_EQ(-std::numeric_limits::min(), + DNegSmallest.convertToDouble()); + + APFloat DSmallestDenorm = + APFloat::getSmallest(APFloat::IEEEdouble(), false); + EXPECT_EQ(std::numeric_limits::denorm_min(), + DSmallestDenorm.convertToDouble()); + APFloat DLargestDenorm(APFloat::IEEEdouble(), "0x0.FFFFFFFFFFFFFp-1022"); + EXPECT_EQ(/*0x0.FFFFFFFFFFFFFp-1022*/ 2.225073858507201e-308, + DLargestDenorm.convertToDouble()); + + APFloat DPosInf = APFloat::getInf(APFloat::IEEEdouble()); + EXPECT_EQ(std::numeric_limits::infinity(), + DPosInf.convertToDouble()); + APFloat DNegInf = APFloat::getInf(APFloat::IEEEdouble(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + DNegInf.convertToDouble()); + APFloat DQNaN = APFloat::getQNaN(APFloat::IEEEdouble()); + EXPECT_TRUE(std::isnan(DQNaN.convertToDouble())); + + APFloat FPosZero(0.0F); + APFloat FPosZeroToDouble(FPosZero.convertToDouble()); + EXPECT_TRUE(FPosZeroToDouble.isPosZero()); + APFloat FNegZero(-0.0F); + APFloat FNegZeroToDouble(FNegZero.convertToDouble()); + EXPECT_TRUE(FNegZeroToDouble.isNegZero()); + } + + // IEEEsingle + { + APFloat FOne(1.0F); + EXPECT_EQ(1.0, FOne.convertToDouble()); + APFloat FPosLargest = APFloat::getLargest(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::max(), FPosLargest.convertToDouble()); + APFloat FNegLargest = APFloat::getLargest(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::max(), + FNegLargest.convertToDouble()); + APFloat FPosSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::min(), + FPosSmallest.convertToDouble()); + APFloat FNegSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::min(), + FNegSmallest.convertToDouble()); + + APFloat FSmallestDenorm = + APFloat::getSmallest(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::denorm_min(), + FSmallestDenorm.convertToDouble()); + APFloat FLargestDenorm(APFloat::IEEEdouble(), "0x0.FFFFFEp-126"); + EXPECT_EQ(/*0x0.FFFFFEp-126*/ 1.1754942106924411e-38, + FLargestDenorm.convertToDouble()); + + APFloat FPosInf = APFloat::getInf(APFloat::IEEEsingle()); + EXPECT_EQ(std::numeric_limits::infinity(), + FPosInf.convertToDouble()); + APFloat FNegInf = APFloat::getInf(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + FNegInf.convertToDouble()); + APFloat FQNaN = APFloat::getQNaN(APFloat::IEEEsingle()); + EXPECT_TRUE(std::isnan(FQNaN.convertToDouble())); + } + + // IEEEhalf + { + APFloat HPosZero = APFloat::getZero(APFloat::IEEEhalf()); + APFloat HPosZeroToDouble(HPosZero.convertToDouble()); + EXPECT_TRUE(HPosZeroToDouble.isPosZero()); + APFloat HNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); + APFloat HNegZeroToDouble(HNegZero.convertToDouble()); + EXPECT_TRUE(HNegZeroToDouble.isNegZero()); + + APFloat HOne(APFloat::IEEEhalf(), "1.0"); + EXPECT_EQ(1.0, HOne.convertToDouble()); + APFloat HPosLargest = APFloat::getLargest(APFloat::IEEEhalf(), false); + EXPECT_EQ(65504.0, HPosLargest.convertToDouble()); + APFloat HNegLargest = APFloat::getLargest(APFloat::IEEEhalf(), true); + EXPECT_EQ(-65504.0, HNegLargest.convertToDouble()); + APFloat HPosSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEhalf(), false); + EXPECT_EQ(/*0x1.p-14*/ 6.103515625e-05, HPosSmallest.convertToDouble()); + APFloat HNegSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEhalf(), true); + EXPECT_EQ(/*-0x1.p-14*/ -6.103515625e-05, HNegSmallest.convertToDouble()); + + APFloat HSmallestDenorm = APFloat::getSmallest(APFloat::IEEEhalf(), false); + EXPECT_EQ(/*0x1.p-24*/ 5.960464477539063e-08, + HSmallestDenorm.convertToDouble()); + APFloat HLargestDenorm(APFloat::IEEEhalf(), "0x1.FFCp-14"); + EXPECT_EQ(/*0x1.FFCp-14*/ 0.00012201070785522461, + HLargestDenorm.convertToDouble()); + + APFloat HPosInf = APFloat::getInf(APFloat::IEEEhalf()); + EXPECT_EQ(std::numeric_limits::infinity(), + HPosInf.convertToDouble()); + APFloat HNegInf = APFloat::getInf(APFloat::IEEEhalf(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + HNegInf.convertToDouble()); + APFloat HQNaN = APFloat::getQNaN(APFloat::IEEEhalf()); + EXPECT_TRUE(std::isnan(HQNaN.convertToDouble())); + + APFloat BPosZero = APFloat::getZero(APFloat::IEEEhalf()); + APFloat BPosZeroToDouble(BPosZero.convertToDouble()); + EXPECT_TRUE(BPosZeroToDouble.isPosZero()); + APFloat BNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); + APFloat BNegZeroToDouble(BNegZero.convertToDouble()); + EXPECT_TRUE(BNegZeroToDouble.isNegZero()); + } + + // BFloat + { + APFloat BOne(APFloat::BFloat(), "1.0"); + EXPECT_EQ(1.0, BOne.convertToDouble()); + APFloat BPosLargest = APFloat::getLargest(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.FEp127*/ 3.3895313892515355e+38, + BPosLargest.convertToDouble()); + APFloat BNegLargest = APFloat::getLargest(APFloat::BFloat(), true); + EXPECT_EQ(/*-0x1.FEp127*/ -3.3895313892515355e+38, + BNegLargest.convertToDouble()); + APFloat BPosSmallest = + APFloat::getSmallestNormalized(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.p-126*/ 1.1754943508222875e-38, + BPosSmallest.convertToDouble()); + APFloat BNegSmallest = + APFloat::getSmallestNormalized(APFloat::BFloat(), true); + EXPECT_EQ(/*-0x1.p-126*/ -1.1754943508222875e-38, + BNegSmallest.convertToDouble()); + + APFloat BSmallestDenorm = APFloat::getSmallest(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.p-133*/ 9.183549615799121e-41, + BSmallestDenorm.convertToDouble()); + APFloat BLargestDenorm(APFloat::BFloat(), "0x1.FCp-127"); + EXPECT_EQ(/*0x1.FCp-127*/ 1.1663108012064884e-38, + BLargestDenorm.convertToDouble()); + + APFloat BPosInf = APFloat::getInf(APFloat::BFloat()); + EXPECT_EQ(std::numeric_limits::infinity(), + BPosInf.convertToDouble()); + APFloat BNegInf = APFloat::getInf(APFloat::BFloat(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + BNegInf.convertToDouble()); + APFloat BQNaN = APFloat::getQNaN(APFloat::BFloat()); + EXPECT_TRUE(std::isnan(BQNaN.convertToDouble())); + } + + // F8M2 + { + APFloat One(APFloat::F8M2(), "1.0"); + EXPECT_EQ(1.0, One.convertToDouble()); + APFloat Two(APFloat::F8M2(), "2.0"); + EXPECT_EQ(2.0, Two.convertToDouble()); + APFloat PosLargest = APFloat::getLargest(APFloat::F8M2(), false); + EXPECT_EQ(5.734400e+04, PosLargest.convertToDouble()); + APFloat NegLargest = APFloat::getLargest(APFloat::F8M2(), true); + EXPECT_EQ(-5.734400e+04, NegLargest.convertToDouble()); + APFloat PosSmallest = + APFloat::getSmallestNormalized(APFloat::F8M2(), false); + EXPECT_EQ(0x1.p-14, PosSmallest.convertToDouble()); + APFloat NegSmallest = APFloat::getSmallestNormalized(APFloat::F8M2(), true); + EXPECT_EQ(-0x1.p-14, NegSmallest.convertToDouble()); + + APFloat SmallestDenorm = APFloat::getSmallest(APFloat::F8M2(), false); + EXPECT_TRUE(SmallestDenorm.isDenormal()); + EXPECT_EQ(0x1p-16, SmallestDenorm.convertToDouble()); + + APFloat PosInf = APFloat::getInf(APFloat::F8M2()); + EXPECT_EQ(std::numeric_limits::infinity(), + PosInf.convertToDouble()); + APFloat NegInf = APFloat::getInf(APFloat::F8M2(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + NegInf.convertToDouble()); + APFloat QNaN = APFloat::getQNaN(APFloat::F8M2()); + EXPECT_TRUE(std::isnan(QNaN.convertToDouble())); + } } TEST(APFloatTest, ToFloat) { - APFloat FPosZero(0.0F); - APFloat FPosZeroToFloat(FPosZero.convertToFloat()); - EXPECT_TRUE(FPosZeroToFloat.isPosZero()); - APFloat FNegZero(-0.0F); - APFloat FNegZeroToFloat(FNegZero.convertToFloat()); - EXPECT_TRUE(FNegZeroToFloat.isNegZero()); - - APFloat FOne(1.0F); - EXPECT_EQ(1.0F, FOne.convertToFloat()); - APFloat FPosLargest = APFloat::getLargest(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::max(), FPosLargest.convertToFloat()); - APFloat FNegLargest = APFloat::getLargest(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::max(), FNegLargest.convertToFloat()); - APFloat FPosSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::min(), FPosSmallest.convertToFloat()); - APFloat FNegSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::min(), FNegSmallest.convertToFloat()); - - APFloat FSmallestDenorm = APFloat::getSmallest(APFloat::IEEEsingle(), false); - EXPECT_EQ(std::numeric_limits::denorm_min(), - FSmallestDenorm.convertToFloat()); - APFloat FLargestDenorm(APFloat::IEEEsingle(), "0x1.FFFFFEp-126"); - EXPECT_EQ(/*0x1.FFFFFEp-126*/ 2.3509885615147286e-38F, - FLargestDenorm.convertToFloat()); - - APFloat FPosInf = APFloat::getInf(APFloat::IEEEsingle()); - EXPECT_EQ(std::numeric_limits::infinity(), FPosInf.convertToFloat()); - APFloat FNegInf = APFloat::getInf(APFloat::IEEEsingle(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), FNegInf.convertToFloat()); - APFloat FQNaN = APFloat::getQNaN(APFloat::IEEEsingle()); - EXPECT_TRUE(std::isnan(FQNaN.convertToFloat())); - - APFloat HPosZero = APFloat::getZero(APFloat::IEEEhalf()); - APFloat HPosZeroToFloat(HPosZero.convertToFloat()); - EXPECT_TRUE(HPosZeroToFloat.isPosZero()); - APFloat HNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); - APFloat HNegZeroToFloat(HNegZero.convertToFloat()); - EXPECT_TRUE(HNegZeroToFloat.isNegZero()); - - APFloat HOne(APFloat::IEEEhalf(), "1.0"); - EXPECT_EQ(1.0F, HOne.convertToFloat()); - APFloat HPosLargest = APFloat::getLargest(APFloat::IEEEhalf(), false); - EXPECT_EQ(/*0x1.FFCp15*/ 65504.0F, HPosLargest.convertToFloat()); - APFloat HNegLargest = APFloat::getLargest(APFloat::IEEEhalf(), true); - EXPECT_EQ(/*-0x1.FFCp15*/ -65504.0F, HNegLargest.convertToFloat()); - APFloat HPosSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEhalf(), false); - EXPECT_EQ(/*0x1.p-14*/ 6.103515625e-05F, HPosSmallest.convertToFloat()); - APFloat HNegSmallest = - APFloat::getSmallestNormalized(APFloat::IEEEhalf(), true); - EXPECT_EQ(/*-0x1.p-14*/ -6.103515625e-05F, HNegSmallest.convertToFloat()); - - APFloat HSmallestDenorm = APFloat::getSmallest(APFloat::IEEEhalf(), false); - EXPECT_EQ(/*0x1.p-24*/ 5.960464477539063e-08F, - HSmallestDenorm.convertToFloat()); - APFloat HLargestDenorm(APFloat::IEEEhalf(), "0x1.FFCp-14"); - EXPECT_EQ(/*0x1.FFCp-14*/ 0.00012201070785522461F, - HLargestDenorm.convertToFloat()); - - APFloat HPosInf = APFloat::getInf(APFloat::IEEEhalf()); - EXPECT_EQ(std::numeric_limits::infinity(), HPosInf.convertToFloat()); - APFloat HNegInf = APFloat::getInf(APFloat::IEEEhalf(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), HNegInf.convertToFloat()); - APFloat HQNaN = APFloat::getQNaN(APFloat::IEEEhalf()); - EXPECT_TRUE(std::isnan(HQNaN.convertToFloat())); - - APFloat BPosZero = APFloat::getZero(APFloat::BFloat()); - APFloat BPosZeroToDouble(BPosZero.convertToFloat()); - EXPECT_TRUE(BPosZeroToDouble.isPosZero()); - APFloat BNegZero = APFloat::getZero(APFloat::BFloat(), true); - APFloat BNegZeroToDouble(BNegZero.convertToFloat()); - EXPECT_TRUE(BNegZeroToDouble.isNegZero()); - - APFloat BOne(APFloat::BFloat(), "1.0"); - EXPECT_EQ(1.0F, BOne.convertToFloat()); - APFloat BPosLargest = APFloat::getLargest(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.FEp127*/ 3.3895313892515355e+38F, - BPosLargest.convertToFloat()); - APFloat BNegLargest = APFloat::getLargest(APFloat::BFloat(), true); - EXPECT_EQ(/*-0x1.FEp127*/ -3.3895313892515355e+38F, - BNegLargest.convertToFloat()); - APFloat BPosSmallest = - APFloat::getSmallestNormalized(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.p-126*/ 1.1754943508222875e-38F, - BPosSmallest.convertToFloat()); - APFloat BNegSmallest = - APFloat::getSmallestNormalized(APFloat::BFloat(), true); - EXPECT_EQ(/*-0x1.p-126*/ -1.1754943508222875e-38F, - BNegSmallest.convertToFloat()); - - APFloat BSmallestDenorm = APFloat::getSmallest(APFloat::BFloat(), false); - EXPECT_EQ(/*0x1.p-133*/ 9.183549615799121e-41F, - BSmallestDenorm.convertToFloat()); - APFloat BLargestDenorm(APFloat::BFloat(), "0x1.FCp-127"); - EXPECT_EQ(/*0x1.FCp-127*/ 1.1663108012064884e-38F, - BLargestDenorm.convertToFloat()); - - APFloat BPosInf = APFloat::getInf(APFloat::BFloat()); - EXPECT_EQ(std::numeric_limits::infinity(), BPosInf.convertToFloat()); - APFloat BNegInf = APFloat::getInf(APFloat::BFloat(), true); - EXPECT_EQ(-std::numeric_limits::infinity(), BNegInf.convertToFloat()); - APFloat BQNaN = APFloat::getQNaN(APFloat::BFloat()); - EXPECT_TRUE(std::isnan(BQNaN.convertToFloat())); -} + // IEEEsingle + { + APFloat FPosZero(0.0F); + APFloat FPosZeroToFloat(FPosZero.convertToFloat()); + EXPECT_TRUE(FPosZeroToFloat.isPosZero()); + APFloat FNegZero(-0.0F); + APFloat FNegZeroToFloat(FNegZero.convertToFloat()); + EXPECT_TRUE(FNegZeroToFloat.isNegZero()); + + APFloat FOne(1.0F); + EXPECT_EQ(1.0F, FOne.convertToFloat()); + APFloat FPosLargest = APFloat::getLargest(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::max(), FPosLargest.convertToFloat()); + APFloat FNegLargest = APFloat::getLargest(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::max(), FNegLargest.convertToFloat()); + APFloat FPosSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::min(), FPosSmallest.convertToFloat()); + APFloat FNegSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::min(), + FNegSmallest.convertToFloat()); + + APFloat FSmallestDenorm = + APFloat::getSmallest(APFloat::IEEEsingle(), false); + EXPECT_EQ(std::numeric_limits::denorm_min(), + FSmallestDenorm.convertToFloat()); + APFloat FLargestDenorm(APFloat::IEEEsingle(), "0x1.FFFFFEp-126"); + EXPECT_EQ(/*0x1.FFFFFEp-126*/ 2.3509885615147286e-38F, + FLargestDenorm.convertToFloat()); + + APFloat FPosInf = APFloat::getInf(APFloat::IEEEsingle()); + EXPECT_EQ(std::numeric_limits::infinity(), FPosInf.convertToFloat()); + APFloat FNegInf = APFloat::getInf(APFloat::IEEEsingle(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + FNegInf.convertToFloat()); + APFloat FQNaN = APFloat::getQNaN(APFloat::IEEEsingle()); + EXPECT_TRUE(std::isnan(FQNaN.convertToFloat())); + } + + // IEEEhalf + { + APFloat HPosZero = APFloat::getZero(APFloat::IEEEhalf()); + APFloat HPosZeroToFloat(HPosZero.convertToFloat()); + EXPECT_TRUE(HPosZeroToFloat.isPosZero()); + APFloat HNegZero = APFloat::getZero(APFloat::IEEEhalf(), true); + APFloat HNegZeroToFloat(HNegZero.convertToFloat()); + EXPECT_TRUE(HNegZeroToFloat.isNegZero()); + + APFloat HOne(APFloat::IEEEhalf(), "1.0"); + EXPECT_EQ(1.0F, HOne.convertToFloat()); + APFloat HPosLargest = APFloat::getLargest(APFloat::IEEEhalf(), false); + EXPECT_EQ(/*0x1.FFCp15*/ 65504.0F, HPosLargest.convertToFloat()); + APFloat HNegLargest = APFloat::getLargest(APFloat::IEEEhalf(), true); + EXPECT_EQ(/*-0x1.FFCp15*/ -65504.0F, HNegLargest.convertToFloat()); + APFloat HPosSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEhalf(), false); + EXPECT_EQ(/*0x1.p-14*/ 6.103515625e-05F, HPosSmallest.convertToFloat()); + APFloat HNegSmallest = + APFloat::getSmallestNormalized(APFloat::IEEEhalf(), true); + EXPECT_EQ(/*-0x1.p-14*/ -6.103515625e-05F, HNegSmallest.convertToFloat()); + + APFloat HSmallestDenorm = APFloat::getSmallest(APFloat::IEEEhalf(), false); + EXPECT_EQ(/*0x1.p-24*/ 5.960464477539063e-08F, + HSmallestDenorm.convertToFloat()); + APFloat HLargestDenorm(APFloat::IEEEhalf(), "0x1.FFCp-14"); + EXPECT_EQ(/*0x1.FFCp-14*/ 0.00012201070785522461F, + HLargestDenorm.convertToFloat()); + + APFloat HPosInf = APFloat::getInf(APFloat::IEEEhalf()); + EXPECT_EQ(std::numeric_limits::infinity(), HPosInf.convertToFloat()); + APFloat HNegInf = APFloat::getInf(APFloat::IEEEhalf(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + HNegInf.convertToFloat()); + APFloat HQNaN = APFloat::getQNaN(APFloat::IEEEhalf()); + EXPECT_TRUE(std::isnan(HQNaN.convertToFloat())); + } + + // BFloat + { + APFloat BPosZero = APFloat::getZero(APFloat::BFloat()); + APFloat BPosZeroToDouble(BPosZero.convertToFloat()); + EXPECT_TRUE(BPosZeroToDouble.isPosZero()); + APFloat BNegZero = APFloat::getZero(APFloat::BFloat(), true); + APFloat BNegZeroToDouble(BNegZero.convertToFloat()); + EXPECT_TRUE(BNegZeroToDouble.isNegZero()); + + APFloat BOne(APFloat::BFloat(), "1.0"); + EXPECT_EQ(1.0F, BOne.convertToFloat()); + APFloat BPosLargest = APFloat::getLargest(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.FEp127*/ 3.3895313892515355e+38F, + BPosLargest.convertToFloat()); + APFloat BNegLargest = APFloat::getLargest(APFloat::BFloat(), true); + EXPECT_EQ(/*-0x1.FEp127*/ -3.3895313892515355e+38F, + BNegLargest.convertToFloat()); + APFloat BPosSmallest = + APFloat::getSmallestNormalized(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.p-126*/ 1.1754943508222875e-38F, + BPosSmallest.convertToFloat()); + APFloat BNegSmallest = + APFloat::getSmallestNormalized(APFloat::BFloat(), true); + EXPECT_EQ(/*-0x1.p-126*/ -1.1754943508222875e-38F, + BNegSmallest.convertToFloat()); + + APFloat BSmallestDenorm = APFloat::getSmallest(APFloat::BFloat(), false); + EXPECT_EQ(/*0x1.p-133*/ 9.183549615799121e-41F, + BSmallestDenorm.convertToFloat()); + APFloat BLargestDenorm(APFloat::BFloat(), "0x1.FCp-127"); + EXPECT_EQ(/*0x1.FCp-127*/ 1.1663108012064884e-38F, + BLargestDenorm.convertToFloat()); + + APFloat BPosInf = APFloat::getInf(APFloat::BFloat()); + EXPECT_EQ(std::numeric_limits::infinity(), BPosInf.convertToFloat()); + APFloat BNegInf = APFloat::getInf(APFloat::BFloat(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), + BNegInf.convertToFloat()); + APFloat BQNaN = APFloat::getQNaN(APFloat::BFloat()); + EXPECT_TRUE(std::isnan(BQNaN.convertToFloat())); + } + + // F8M2 + { + APFloat PosZero = APFloat::getZero(APFloat::F8M2()); + APFloat PosZeroToFloat(PosZero.convertToFloat()); + EXPECT_TRUE(PosZeroToFloat.isPosZero()); + APFloat NegZero = APFloat::getZero(APFloat::F8M2(), true); + APFloat NegZeroToFloat(NegZero.convertToFloat()); + EXPECT_TRUE(NegZeroToFloat.isNegZero()); + + APFloat One(APFloat::F8M2(), "1.0"); + EXPECT_EQ(1.0F, One.convertToFloat()); + APFloat Two(APFloat::F8M2(), "2.0"); + EXPECT_EQ(2.0F, Two.convertToFloat()); + + APFloat PosLargest = APFloat::getLargest(APFloat::F8M2(), false); + EXPECT_EQ(5.734400e+04, PosLargest.convertToFloat()); + APFloat NegLargest = APFloat::getLargest(APFloat::F8M2(), true); + EXPECT_EQ(-5.734400e+04, NegLargest.convertToFloat()); + APFloat PosSmallest = + APFloat::getSmallestNormalized(APFloat::F8M2(), false); + EXPECT_EQ(0x1.p-14, PosSmallest.convertToFloat()); + APFloat NegSmallest = APFloat::getSmallestNormalized(APFloat::F8M2(), true); + EXPECT_EQ(-0x1.p-14, NegSmallest.convertToFloat()); + + APFloat SmallestDenorm = APFloat::getSmallest(APFloat::F8M2(), false); + EXPECT_TRUE(SmallestDenorm.isDenormal()); + EXPECT_EQ(0x1.p-16, SmallestDenorm.convertToFloat()); + + APFloat PosInf = APFloat::getInf(APFloat::F8M2()); + EXPECT_EQ(std::numeric_limits::infinity(), PosInf.convertToFloat()); + APFloat NegInf = APFloat::getInf(APFloat::F8M2(), true); + EXPECT_EQ(-std::numeric_limits::infinity(), NegInf.convertToFloat()); + APFloat QNaN = APFloat::getQNaN(APFloat::F8M2()); + EXPECT_TRUE(std::isnan(QNaN.convertToFloat())); + } } +} // namespace diff --git a/mlir/include/mlir-c/BuiltinTypes.h b/mlir/include/mlir-c/BuiltinTypes.h --- a/mlir/include/mlir-c/BuiltinTypes.h +++ b/mlir/include/mlir-c/BuiltinTypes.h @@ -67,6 +67,13 @@ // Floating-point types. //===----------------------------------------------------------------------===// +/// Checks whether the given type is an f8m2 type. +MLIR_CAPI_EXPORTED bool mlirTypeIsAF8M2(MlirType type); + +/// Creates an f8m2 type in the given context. The type is owned by the +/// context. +MLIR_CAPI_EXPORTED MlirType mlirF8M2TypeGet(MlirContext ctx); + /// Checks whether the given type is a bf16 type. MLIR_CAPI_EXPORTED bool mlirTypeIsABF16(MlirType type); diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h --- a/mlir/include/mlir/IR/Builders.h +++ b/mlir/include/mlir/IR/Builders.h @@ -59,6 +59,7 @@ Attribute metadata = Attribute()); // Types. + FloatType getF8M2Type(); FloatType getBF16Type(); FloatType getF16Type(); FloatType getF32Type(); diff --git a/mlir/include/mlir/IR/BuiltinTypes.h b/mlir/include/mlir/IR/BuiltinTypes.h --- a/mlir/include/mlir/IR/BuiltinTypes.h +++ b/mlir/include/mlir/IR/BuiltinTypes.h @@ -46,6 +46,7 @@ static FloatType getF64(MLIRContext *ctx); static FloatType getF80(MLIRContext *ctx); static FloatType getF128(MLIRContext *ctx); + static FloatType getF8M2(MLIRContext *ctx); /// Methods for support type inquiry through isa, cast, and dyn_cast. static bool classof(Type type); @@ -373,8 +374,12 @@ } inline bool FloatType::classof(Type type) { - return type.isa(); + return type.isa(); +} + +inline FloatType FloatType::getF8M2(MLIRContext *ctx) { + return Float8M2Type::get(ctx); } inline FloatType FloatType::getBF16(MLIRContext *ctx) { diff --git a/mlir/include/mlir/IR/BuiltinTypes.td b/mlir/include/mlir/IR/BuiltinTypes.td --- a/mlir/include/mlir/IR/BuiltinTypes.td +++ b/mlir/include/mlir/IR/BuiltinTypes.td @@ -76,6 +76,26 @@ }]; } +//===----------------------------------------------------------------------===// +// Float8M2Type + +def Builtin_Float8M2 : Builtin_FloatType<"Float8M2"> { + let summary = "8-bit floating point with 2 bit mantissa"; + let description = [{ + An 8-bit floating point type with 1 sign bit, 5 bits exponent and 2 bits + mantissa. This is not a standard type as defined by IEEE-754, but it + follows similar conventions with the following characteristics: + + * bit encoding: S1E5M2 + * exponent bias: 15 + * infinities: supported with exponent set to all 1s and mantissa 0s + * NaNs: supported with exponent bits set to all 1s and mantissa of + (01, 10, or 11) + * denormals when exponent is 0 + }]; +} + + //===----------------------------------------------------------------------===// // BFloat16Type diff --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h --- a/mlir/include/mlir/IR/Types.h +++ b/mlir/include/mlir/IR/Types.h @@ -123,6 +123,7 @@ // Convenience predicates. This is only for floating point types, // derived types should use isa/dyn_cast. bool isIndex() const; + bool isF8M2() const; bool isBF16() const; bool isF16() const; bool isF32() const; diff --git a/mlir/lib/AsmParser/TokenKinds.def b/mlir/lib/AsmParser/TokenKinds.def --- a/mlir/lib/AsmParser/TokenKinds.def +++ b/mlir/lib/AsmParser/TokenKinds.def @@ -93,6 +93,7 @@ TOK_KEYWORD(f32) TOK_KEYWORD(f64) TOK_KEYWORD(f80) +TOK_KEYWORD(f8m2) TOK_KEYWORD(f128) TOK_KEYWORD(false) TOK_KEYWORD(floordiv) diff --git a/mlir/lib/AsmParser/TypeParser.cpp b/mlir/lib/AsmParser/TypeParser.cpp --- a/mlir/lib/AsmParser/TypeParser.cpp +++ b/mlir/lib/AsmParser/TypeParser.cpp @@ -30,6 +30,7 @@ case Token::kw_tuple: case Token::kw_vector: case Token::inttype: + case Token::kw_f8m2: case Token::kw_bf16: case Token::kw_f16: case Token::kw_f32: @@ -286,6 +287,9 @@ } // float-type + case Token::kw_f8m2: + consumeToken(Token::kw_f8m2); + return builder.getF8M2Type(); case Token::kw_bf16: consumeToken(Token::kw_bf16); return builder.getBF16Type(); diff --git a/mlir/lib/CAPI/IR/BuiltinTypes.cpp b/mlir/lib/CAPI/IR/BuiltinTypes.cpp --- a/mlir/lib/CAPI/IR/BuiltinTypes.cpp +++ b/mlir/lib/CAPI/IR/BuiltinTypes.cpp @@ -68,6 +68,12 @@ // Floating-point types. //===----------------------------------------------------------------------===// +bool mlirTypeIsAF8M2(MlirType type) { return unwrap(type).isF8M2(); } + +MlirType mlirF8M2TypeGet(MlirContext ctx) { + return wrap(FloatType::getF8M2(unwrap(ctx))); +} + bool mlirTypeIsABF16(MlirType type) { return unwrap(type).isBF16(); } MlirType mlirBF16TypeGet(MlirContext ctx) { diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -2174,6 +2174,7 @@ opaqueTy.getTypeData()); }) .Case([&](Type) { os << "index"; }) + .Case([&](Type) { os << "f8m2"; }) .Case([&](Type) { os << "bf16"; }) .Case([&](Type) { os << "f16"; }) .Case([&](Type) { os << "f32"; }) diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp --- a/mlir/lib/IR/Builders.cpp +++ b/mlir/lib/IR/Builders.cpp @@ -33,6 +33,8 @@ // Types. //===----------------------------------------------------------------------===// +FloatType Builder::getF8M2Type() { return FloatType::getF8M2(context); } + FloatType Builder::getBF16Type() { return FloatType::getBF16(context); } FloatType Builder::getF16Type() { return FloatType::getF16(context); } diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -88,6 +88,8 @@ //===----------------------------------------------------------------------===// unsigned FloatType::getWidth() { + if (isa()) + return 8; if (isa()) return 16; if (isa()) @@ -103,6 +105,8 @@ /// Returns the floating semantics for the given type. const llvm::fltSemantics &FloatType::getFloatSemantics() { + if (isa()) + return APFloat::F8M2(); if (isa()) return APFloat::BFloat(); if (isa()) diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -206,6 +206,7 @@ StorageUniquer typeUniquer; /// Cached Type Instances. + Float8M2Type f8m2Ty; BFloat16Type bf16Ty; Float16Type f16Ty; Float32Type f32Ty; @@ -276,6 +277,7 @@ //// Types. /// Floating-point Types. + impl->f8m2Ty = TypeUniquer::get(this); impl->bf16Ty = TypeUniquer::get(this); impl->f16Ty = TypeUniquer::get(this); impl->f32Ty = TypeUniquer::get(this); @@ -805,6 +807,9 @@ /// This should not be used directly. StorageUniquer &MLIRContext::getTypeUniquer() { return getImpl().typeUniquer; } +Float8M2Type Float8M2Type::get(MLIRContext *context) { + return context->getImpl().f8m2Ty; +} BFloat16Type BFloat16Type::get(MLIRContext *context) { return context->getImpl().bf16Ty; } diff --git a/mlir/lib/IR/Types.cpp b/mlir/lib/IR/Types.cpp --- a/mlir/lib/IR/Types.cpp +++ b/mlir/lib/IR/Types.cpp @@ -18,6 +18,7 @@ MLIRContext *Type::getContext() const { return getDialect().getContext(); } +bool Type::isF8M2() const { return isa(); } bool Type::isBF16() const { return isa(); } bool Type::isF16() const { return isa(); } bool Type::isF32() const { return isa(); } diff --git a/mlir/test/IR/attribute.mlir b/mlir/test/IR/attribute.mlir --- a/mlir/test/IR/attribute.mlir +++ b/mlir/test/IR/attribute.mlir @@ -31,6 +31,42 @@ // ----- +//===----------------------------------------------------------------------===// +// Test float attributes +//===----------------------------------------------------------------------===// + +func.func @float_attrs_pass() { + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f8m2 + float_attr = 2. : f8m2 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f16 + float_attr = 2. : f16 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : bf16 + float_attr = 2. : bf16 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f32 + float_attr = 2. : f32 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f64 + float_attr = 2. : f64 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f80 + float_attr = 2. : f80 + } : () -> () + "test.float_attrs"() { + // CHECK: float_attr = 2.000000e+00 : f128 + float_attr = 2. : f128 + } : () -> () + return +} + //===----------------------------------------------------------------------===// // Test integer attributes //===----------------------------------------------------------------------===// diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td --- a/mlir/test/lib/Dialect/Test/TestOps.td +++ b/mlir/test/lib/Dialect/Test/TestOps.td @@ -193,6 +193,14 @@ let assemblyFormat = "$attr attr-dict"; } +def FloatAttrOp : TEST_Op<"float_attrs"> { + // TODO: Clean up the OpBase float type and attribute selectors so they + // can express all of the types. + let arguments = (ins + AnyAttr:$float_attr + ); +} + def I32Case5: I32EnumAttrCase<"case5", 5>; def I32Case10: I32EnumAttrCase<"case10", 10>;