summaryrefslogtreecommitdiff
path: root/absl/random/exponential_distribution_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/random/exponential_distribution_test.cc')
-rw-r--r--absl/random/exponential_distribution_test.cc32
1 files changed, 10 insertions, 22 deletions
diff --git a/absl/random/exponential_distribution_test.cc b/absl/random/exponential_distribution_test.cc
index 8e9e69b6..af11d61c 100644
--- a/absl/random/exponential_distribution_test.cc
+++ b/absl/random/exponential_distribution_test.cc
@@ -30,6 +30,7 @@
#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
+#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
@@ -47,11 +48,15 @@ using absl::random_internal::kChiSquared;
template <typename RealType>
class ExponentialDistributionTypedTest : public ::testing::Test {};
-#if defined(__EMSCRIPTEN__)
-using RealTypes = ::testing::Types<float, double>;
-#else
-using RealTypes = ::testing::Types<float, double, long double>;
-#endif // defined(__EMSCRIPTEN__)
+// double-double arithmetic is not supported well by either GCC or Clang; see
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99048,
+// https://bugs.llvm.org/show_bug.cgi?id=49131, and
+// https://bugs.llvm.org/show_bug.cgi?id=49132. Don't bother running these tests
+// with double doubles until compiler support is better.
+using RealTypes =
+ std::conditional<absl::numeric_internal::IsDoubleDouble(),
+ ::testing::Types<float, double>,
+ ::testing::Types<float, double, long double>>::type;
TYPED_TEST_CASE(ExponentialDistributionTypedTest, RealTypes);
TYPED_TEST(ExponentialDistributionTypedTest, SerializeTest) {
@@ -130,23 +135,6 @@ TYPED_TEST(ExponentialDistributionTypedTest, SerializeTest) {
ss >> after;
-#if defined(__powerpc64__) || defined(__PPC64__) || defined(__powerpc__) || \
- defined(__ppc__) || defined(__PPC__)
- if (std::is_same<TypeParam, long double>::value) {
- // Roundtripping floating point values requires sufficient precision to
- // reconstruct the exact value. It turns out that long double has some
- // errors doing this on ppc, particularly for values
- // near {1.0 +/- epsilon}.
- if (lambda <= std::numeric_limits<double>::max() &&
- lambda >= std::numeric_limits<double>::lowest()) {
- EXPECT_EQ(static_cast<double>(before.lambda()),
- static_cast<double>(after.lambda()))
- << ss.str();
- }
- continue;
- }
-#endif
-
EXPECT_EQ(before.lambda(), after.lambda()) //
<< ss.str() << " " //
<< (ss.good() ? "good " : "") //