[libc-commits] [libc] ae5c472 - [libc] Reduce math tests runtime

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed May 31 22:02:06 PDT 2023


Author: Guillaume Chatelet
Date: 2023-06-01T05:01:56Z
New Revision: ae5c47241025f3c72b5ada9ee6b4b358fa9e6387

URL: https://github.com/llvm/llvm-project/commit/ae5c47241025f3c72b5ada9ee6b4b358fa9e6387
DIFF: https://github.com/llvm/llvm-project/commit/ae5c47241025f3c72b5ada9ee6b4b358fa9e6387.diff

LOG: [libc] Reduce math tests runtime

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D151798

Added: 
    

Modified: 
    libc/test/src/math/CeilTest.h
    libc/test/src/math/CopySignTest.h
    libc/test/src/math/FAbsTest.h
    libc/test/src/math/FDimTest.h
    libc/test/src/math/FMaxTest.h
    libc/test/src/math/FMinTest.h
    libc/test/src/math/FloorTest.h
    libc/test/src/math/FrexpTest.h
    libc/test/src/math/ILogbTest.h
    libc/test/src/math/LogbTest.h
    libc/test/src/math/ModfTest.h
    libc/test/src/math/RoundTest.h
    libc/test/src/math/TruncTest.h
    libc/test/src/math/acosf_test.cpp
    libc/test/src/math/acoshf_test.cpp
    libc/test/src/math/asinf_test.cpp
    libc/test/src/math/atanf_test.cpp
    libc/test/src/math/atanhf_test.cpp
    libc/test/src/math/cos_test.cpp
    libc/test/src/math/cosf_test.cpp
    libc/test/src/math/coshf_test.cpp
    libc/test/src/math/exp10f_test.cpp
    libc/test/src/math/exp2f_test.cpp
    libc/test/src/math/expf_test.cpp
    libc/test/src/math/expm1f_test.cpp
    libc/test/src/math/log10f_test.cpp
    libc/test/src/math/log1pf_test.cpp
    libc/test/src/math/log2f_test.cpp
    libc/test/src/math/logf_test.cpp
    libc/test/src/math/sin_test.cpp
    libc/test/src/math/sinf_test.cpp
    libc/test/src/math/sinhf_test.cpp
    libc/test/src/math/tan_test.cpp
    libc/test/src/math/tanf_test.cpp
    libc/test/src/math/tanhf_test.cpp
    libc/test/utils/FPUtil/x86_long_double_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index ca71518ae0c5f..78c1a08b9c82e 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -64,7 +64,7 @@ template <typename T> class CeilTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(CeilFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h
index 477c1b9bf1f59..3d1eed1b06624 100644
--- a/libc/test/src/math/CopySignTest.h
+++ b/libc/test/src/math/CopySignTest.h
@@ -33,7 +33,7 @@ template <typename T> class CopySignTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(CopySignFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h
index a46ca4bf8d1a6..38b09cff19e2d 100644
--- a/libc/test/src/math/FAbsTest.h
+++ b/libc/test/src/math/FAbsTest.h
@@ -32,7 +32,7 @@ template <typename T> class FAbsTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(FabsFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h
index 0bf15038e1836..c0dbda10b318b 100644
--- a/libc/test/src/math/FDimTest.h
+++ b/libc/test/src/math/FDimTest.h
@@ -53,7 +53,7 @@ class FDimTestTemplate : public __llvm_libc::testing::Test {
   }
 
   void test_in_range(FuncPtr func) {
-    constexpr UIntType COUNT = 10000001;
+    constexpr UIntType COUNT = 100'001;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
          ++i, v += STEP, w -= STEP) {

diff  --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h
index 4e23144345710..0a6c767588c11 100644
--- a/libc/test/src/math/FMaxTest.h
+++ b/libc/test/src/math/FMaxTest.h
@@ -55,7 +55,7 @@ template <typename T> class FMaxTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(FMaxFunc func) {
-    constexpr UIntType COUNT = 10000001;
+    constexpr UIntType COUNT = 100'001;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
          ++i, v += STEP, w -= STEP) {

diff  --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h
index e02a5ae939af8..10c87f9d6a102 100644
--- a/libc/test/src/math/FMinTest.h
+++ b/libc/test/src/math/FMinTest.h
@@ -55,7 +55,7 @@ template <typename T> class FMinTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(FMinFunc func) {
-    constexpr UIntType COUNT = 10000001;
+    constexpr UIntType COUNT = 100'001;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0, w = UIntType(-1); i <= COUNT;
          ++i, v += STEP, w -= STEP) {

diff  --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index c830c04d087ca..ce1075af76995 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -64,7 +64,7 @@ template <typename T> class FloorTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(FloorFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h
index 1a9d7de596c29..6bfb4d276e985 100644
--- a/libc/test/src/math/FrexpTest.h
+++ b/libc/test/src/math/FrexpTest.h
@@ -93,7 +93,7 @@ template <typename T> class FrexpTest : public __llvm_libc::testing::Test {
 
   void testRange(FrexpFunc func) {
     using UIntType = typename FPBits::UIntType;
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = static_cast<T>(FPBits(v));

diff  --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h
index ae26c4e5a0388..45e997427c834 100644
--- a/libc/test/src/math/ILogbTest.h
+++ b/libc/test/src/math/ILogbTest.h
@@ -18,7 +18,9 @@
 
 class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
 public:
-  template <typename T> struct ILogbFunc { typedef int (*Func)(T); };
+  template <typename T> struct ILogbFunc {
+    typedef int (*Func)(T);
+  };
 
   template <typename T>
   void test_special_numbers(typename ILogbFunc<T>::Func func) {
@@ -75,7 +77,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
   void test_subnormal_range(typename ILogbFunc<T>::Func func) {
     using FPBits = __llvm_libc::fputil::FPBits<T>;
     using UIntType = typename FPBits::UIntType;
-    constexpr UIntType COUNT = 1000001;
+    constexpr UIntType COUNT = 10'001;
     constexpr UIntType STEP =
         (FPBits::MAX_SUBNORMAL - FPBits::MIN_SUBNORMAL) / COUNT;
     for (UIntType v = FPBits::MIN_SUBNORMAL; v <= FPBits::MAX_SUBNORMAL;
@@ -94,7 +96,7 @@ class LlvmLibcILogbTest : public __llvm_libc::testing::Test {
   void test_normal_range(typename ILogbFunc<T>::Func func) {
     using FPBits = __llvm_libc::fputil::FPBits<T>;
     using UIntType = typename FPBits::UIntType;
-    constexpr UIntType COUNT = 1000001;
+    constexpr UIntType COUNT = 10'001;
     constexpr UIntType STEP = (FPBits::MAX_NORMAL - FPBits::MIN_NORMAL) / COUNT;
     for (UIntType v = FPBits::MIN_NORMAL; v <= FPBits::MAX_NORMAL; v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h
index d2428ae85a0d4..b4a17fd9b0c34 100644
--- a/libc/test/src/math/LogbTest.h
+++ b/libc/test/src/math/LogbTest.h
@@ -72,7 +72,7 @@ template <typename T> class LogbTest : public __llvm_libc::testing::Test {
 
   void testRange(LogbFunc func) {
     using UIntType = typename FPBits::UIntType;
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = static_cast<T>(FPBits(v));

diff  --git a/libc/test/src/math/ModfTest.h b/libc/test/src/math/ModfTest.h
index f6073257ee5f8..e4596c232287a 100644
--- a/libc/test/src/math/ModfTest.h
+++ b/libc/test/src/math/ModfTest.h
@@ -84,7 +84,7 @@ template <typename T> class ModfTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(ModfFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h
index f4f40ff34b27f..0e104e22444b5 100644
--- a/libc/test/src/math/RoundTest.h
+++ b/libc/test/src/math/RoundTest.h
@@ -64,7 +64,7 @@ template <typename T> class RoundTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(RoundFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index 9fe3c27900de7..7d9e1cbb5ae2f 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -64,7 +64,7 @@ template <typename T> class TruncTest : public __llvm_libc::testing::Test {
   }
 
   void testRange(TruncFunc func) {
-    constexpr UIntType COUNT = 10000000;
+    constexpr UIntType COUNT = 100'000;
     constexpr UIntType STEP = UIntType(-1) / COUNT;
     for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
       T x = T(FPBits(v));

diff  --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp
index 0d2db1275d123..1d4000c10eb83 100644
--- a/libc/test/src/math/acosf_test.cpp
+++ b/libc/test/src/math/acosf_test.cpp
@@ -37,7 +37,7 @@ TEST(LlvmLibcAcosfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAcosfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp
index 03f3a30c4ab07..148813ce28495 100644
--- a/libc/test/src/math/acoshf_test.cpp
+++ b/libc/test/src/math/acoshf_test.cpp
@@ -43,7 +43,7 @@ TEST(LlvmLibcAcoshfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAcoshfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits_t(v));

diff  --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp
index 439d23c8d1b58..cd1431ae73939 100644
--- a/libc/test/src/math/asinf_test.cpp
+++ b/libc/test/src/math/asinf_test.cpp
@@ -44,7 +44,7 @@ TEST(LlvmLibcAsinfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAsinfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp
index dbe1d485295ac..208104cc26dd9 100644
--- a/libc/test/src/math/atanf_test.cpp
+++ b/libc/test/src/math/atanf_test.cpp
@@ -44,7 +44,7 @@ TEST(LlvmLibcAtanfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAtanfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   const uint32_t STEP = FPBits(inf).uintval() / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp
index b11a9dfe1e2b0..7dce915714844 100644
--- a/libc/test/src/math/atanhf_test.cpp
+++ b/libc/test/src/math/atanhf_test.cpp
@@ -86,7 +86,7 @@ TEST(LlvmLibcAtanhfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcAtanhfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   const uint32_t STEP = FPBits(1.0f).uintval() / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/cos_test.cpp b/libc/test/src/math/cos_test.cpp
index 6695272f52bf2..f93d8699e7302 100644
--- a/libc/test/src/math/cos_test.cpp
+++ b/libc/test/src/math/cos_test.cpp
@@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
 
 TEST(LlvmLibccosTest, Range) {
   static constexpr double _2pi = 6.283185307179586;
-  constexpr UIntType COUNT = 10000000;
+  constexpr UIntType COUNT = 100'000;
   constexpr UIntType STEP = UIntType(-1) / COUNT;
   for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     double x = double(FPBits(v));

diff  --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index 721ca32068485..e9a7ea5db7429 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -45,7 +45,7 @@ TEST(LlvmLibcCosfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcCosfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp
index 88354a100a533..90ce3044b2c11 100644
--- a/libc/test/src/math/coshf_test.cpp
+++ b/libc/test/src/math/coshf_test.cpp
@@ -59,7 +59,7 @@ TEST(LlvmLibcCoshfTest, Overflow) {
 }
 
 TEST(LlvmLibcCoshfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp
index 2feb064cf565b..384f9064db107 100644
--- a/libc/test/src/math/exp10f_test.cpp
+++ b/libc/test/src/math/exp10f_test.cpp
@@ -106,7 +106,7 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) {
 }
 
 TEST(LlvmLibcExp10fTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index e442a7c57a5e1..afd2c0f700514 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -103,7 +103,7 @@ TEST(LlvmLibcExp2fTest, Underflow) {
 }
 
 TEST(LlvmLibcExp2fTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp
index 1926c9c03da0c..acc0e645a4186 100644
--- a/libc/test/src/math/expf_test.cpp
+++ b/libc/test/src/math/expf_test.cpp
@@ -104,7 +104,7 @@ TEST(LlvmLibcExpfTest, Borderline) {
 }
 
 TEST(LlvmLibcExpfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp
index 81bc18a18dccc..c05edf8da3cd7 100644
--- a/libc/test/src/math/expm1f_test.cpp
+++ b/libc/test/src/math/expm1f_test.cpp
@@ -113,7 +113,7 @@ TEST(LlvmLibcExpm1fTest, Borderline) {
 }
 
 TEST(LlvmLibcExpm1fTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp
index 1ae604bd92332..444a742003235 100644
--- a/libc/test/src/math/log10f_test.cpp
+++ b/libc/test/src/math/log10f_test.cpp
@@ -65,7 +65,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) {
 }
 
 TEST(LlvmLibcLog10fTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp
index e5137e62ce0a1..264687d5fc2b0 100644
--- a/libc/test/src/math/log1pf_test.cpp
+++ b/libc/test/src/math/log1pf_test.cpp
@@ -70,7 +70,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) {
 }
 
 TEST(LlvmLibclog1pfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp
index 0c8a160bd5c36..afc7a748c63d5 100644
--- a/libc/test/src/math/log2f_test.cpp
+++ b/libc/test/src/math/log2f_test.cpp
@@ -44,7 +44,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) {
 }
 
 TEST(LlvmLibcLog2fTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/logf_test.cpp b/libc/test/src/math/logf_test.cpp
index 5d9b2ab9a0d16..6f8983c4645df 100644
--- a/libc/test/src/math/logf_test.cpp
+++ b/libc/test/src/math/logf_test.cpp
@@ -76,7 +76,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) {
 }
 
 TEST(LlvmLibcLogfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp
index 3b31689ba0bce..d92bd8553a2ef 100644
--- a/libc/test/src/math/sin_test.cpp
+++ b/libc/test/src/math/sin_test.cpp
@@ -20,7 +20,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
 
 TEST(LlvmLibcSinTest, Range) {
   static constexpr double _2pi = 6.283185307179586;
-  constexpr UIntType COUNT = 10000000;
+  constexpr UIntType COUNT = 100'000;
   constexpr UIntType STEP = UIntType(-1) / COUNT;
   for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     double x = double(FPBits(v));

diff  --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index a4a2eda7fd376..3c94ae86a21c4 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -45,7 +45,7 @@ TEST(LlvmLibcSinfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcSinfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp
index c0a07756f17c1..f42b8318af824 100644
--- a/libc/test/src/math/sinhf_test.cpp
+++ b/libc/test/src/math/sinhf_test.cpp
@@ -44,7 +44,7 @@ TEST(LlvmLibcSinhfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcSinhfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/tan_test.cpp b/libc/test/src/math/tan_test.cpp
index aabf9cc0eb663..b22d49ef5f432 100644
--- a/libc/test/src/math/tan_test.cpp
+++ b/libc/test/src/math/tan_test.cpp
@@ -19,7 +19,7 @@ DECLARE_SPECIAL_CONSTANTS(double)
 
 TEST(LlvmLibctanTest, Range) {
   static constexpr double _2pi = 6.283185307179586;
-  constexpr UIntType COUNT = 10000000;
+  constexpr UIntType COUNT = 100'000;
   constexpr UIntType STEP = UIntType(-1) / COUNT;
   for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     double x = double(FPBits(v));

diff  --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp
index a513a036aea16..37a1bba68412a 100644
--- a/libc/test/src/math/tanf_test.cpp
+++ b/libc/test/src/math/tanf_test.cpp
@@ -45,7 +45,7 @@ TEST(LlvmLibcTanfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcTanfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp
index 6e7a1b472a611..f4a4b72dd162a 100644
--- a/libc/test/src/math/tanhf_test.cpp
+++ b/libc/test/src/math/tanhf_test.cpp
@@ -43,7 +43,7 @@ TEST(LlvmLibcTanhfTest, SpecialNumbers) {
 }
 
 TEST(LlvmLibcTanhfTest, InFloatRange) {
-  constexpr uint32_t COUNT = 1000000;
+  constexpr uint32_t COUNT = 100'000;
   constexpr uint32_t STEP = UINT32_MAX / COUNT;
   for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
     float x = float(FPBits(v));

diff  --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp
index c2435b43ab72b..e116482c500a2 100644
--- a/libc/test/utils/FPUtil/x86_long_double_test.cpp
+++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp
@@ -19,10 +19,11 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
   // builtin function. Hence, matching LLVM-libc's notion of NaN with the
   // isnan result ensures that LLVM-libc's behavior matches the compiler's
   // behavior.
+  constexpr uint32_t COUNT = 100'000;
 
   FPBits bits(0.0l);
   bits.set_unbiased_exponent(FPBits::MAX_EXPONENT);
-  for (unsigned int i = 0; i < 1000000; ++i) {
+  for (unsigned int i = 0; i < COUNT; ++i) {
     // If exponent has the max value and the implicit bit is 0,
     // then the number is a NaN for all values of mantissa.
     bits.set_mantissa(i);
@@ -32,7 +33,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
   }
 
   bits.set_implicit_bit(1);
-  for (unsigned int i = 1; i < 1000000; ++i) {
+  for (unsigned int i = 1; i < COUNT; ++i) {
     // If exponent has the max value and the implicit bit is 1,
     // then the number is a NaN for all non-zero values of mantissa.
     // Note the initial value of |i| of 1 to avoid a zero mantissa.
@@ -44,7 +45,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
 
   bits.set_unbiased_exponent(1);
   bits.set_implicit_bit(0);
-  for (unsigned int i = 0; i < 1000000; ++i) {
+  for (unsigned int i = 0; i < COUNT; ++i) {
     // If exponent is non-zero and also not max, and the implicit bit is 0,
     // then the number is a NaN for all values of mantissa.
     bits.set_mantissa(i);
@@ -55,7 +56,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
 
   bits.set_unbiased_exponent(1);
   bits.set_implicit_bit(1);
-  for (unsigned int i = 0; i < 1000000; ++i) {
+  for (unsigned int i = 0; i < COUNT; ++i) {
     // If exponent is non-zero and also not max, and the implicit bit is 1,
     // then the number is normal value for all values of mantissa.
     bits.set_mantissa(i);
@@ -66,7 +67,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
 
   bits.set_unbiased_exponent(0);
   bits.set_implicit_bit(1);
-  for (unsigned int i = 0; i < 1000000; ++i) {
+  for (unsigned int i = 0; i < COUNT; ++i) {
     // If exponent is zero, then the number is a valid but denormal value.
     bits.set_mantissa(i);
     long double valid = bits;
@@ -76,7 +77,7 @@ TEST(LlvmLibcX86LongDoubleTest, is_nan) {
 
   bits.set_unbiased_exponent(0);
   bits.set_implicit_bit(0);
-  for (unsigned int i = 0; i < 1000000; ++i) {
+  for (unsigned int i = 0; i < COUNT; ++i) {
     // If exponent is zero, then the number is a valid but denormal value.
     bits.set_mantissa(i);
     long double valid = bits;


        


More information about the libc-commits mailing list