[gcc r17-2583] libstdc++: Handle ibm128 in generate_canonical tests.
Tomasz Kaminski
tkaminsk@gcc.gnu.org
Tue Jul 21 11:30:46 GMT 2026
https://gcc.gnu.org/g:ef6451b6aec387c5693719fe048c4f11a6be2edb
commit r17-2583-gef6451b6aec387c5693719fe048c4f11a6be2edb
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date: Tue Jul 21 13:25:13 2026 +0200
libstdc++: Handle ibm128 in generate_canonical tests.
Numeric traits for ibm128 (double-double) reports is_iec559 as true,
and thus was hitting VERIFY(false) default branch.
libstdc++-v3/ChangeLog:
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Remove trailing whitespace. Handle 106 (ibm128) mantissa size.
Diff:
---
.../operators/gencanon.cc | 27 +++++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
index ae93ec13b7a3..1161d5603c26 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc
@@ -16,7 +16,7 @@ struct local_rng : std::mt19937
static constexpr std::uint64_t max() { return max_val; }
std::uint64_t operator()()
{ return std::mt19937::operator()() % (max() + 1); }
-
+
local_rng(std::mt19937 const& arg) : std::mt19937(arg) {}
};
@@ -30,7 +30,7 @@ int ifloor(__float128 t)
#endif
// Verify P0952R2 implementation requiring a second round-trip
-// if first yields exactly 1.
+// if first yields exactly 1.
template<typename T, size_t bits,
size_t call_per_elem, size_t max_skips_per_elem,
typename RNG>
@@ -106,12 +106,13 @@ test_2p32(const std::mt19937& rng)
VERIFY(zeros == 0);
break;
case 53: // ieee64
- case 64: // ieee80
+ case 64: // ieee80
VERIFY(deviation == 7650);
VERIFY(max == 259);
VERIFY(rms == 975);
VERIFY(zeros == 0);
break;
+ case 106: // ibm128
case 113: // ieee128
VERIFY(deviation == 9086);
VERIFY(max == 290);
@@ -159,13 +160,20 @@ test_10p6(const std::mt19937& rng)
VERIFY(rms == 921);
VERIFY(zeros == 0);
break;
- case 64: // ieee80
+ case 64: // ieee80
VERIFY(skips == 1);
VERIFY(deviation == 7774);
VERIFY(max == 250);
VERIFY(rms == 958);
VERIFY(zeros == 0);
break;
+ case 106: // ibm128
+ VERIFY(skips == 96);
+ VERIFY(deviation == 6980);
+ VERIFY(max == 260);
+ VERIFY(rms == 876);
+ VERIFY(zeros == 0);
+ break;
case 113: // ieee128
VERIFY(skips == 3074);
VERIFY(deviation == 7568);
@@ -214,13 +222,20 @@ test_2p31m1(const std::mt19937& rng)
VERIFY(rms == 937);
VERIFY(zeros == 0);
break;
- case 64: // ieee80
+ case 64: // ieee80
VERIFY(skips == 143342);
VERIFY(deviation == 7788);
VERIFY(max == 296);
VERIFY(rms == 977);
VERIFY(zeros == 0);
break;
+ case 106: // ibm128
+ VERIFY(skips == 0);
+ VERIFY(deviation == 8828);
+ VERIFY(max == 330);
+ VERIFY(rms == 1084);
+ VERIFY(zeros == 0);
+ break;
case 113: // ieee128
VERIFY(skips == 8);
VERIFY(deviation == 8824);
@@ -240,7 +255,7 @@ int main()
std::seed_seq sequence{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
rng.seed(sequence);
rng.discard(12 * 629143);
-
+
test_2p32<float>(rng);
test_10p6<float>(rng);
test_2p31m1<float>(rng);
More information about the Libstdc++-cvs
mailing list