[libc][NFC] Reduce the test size for math functions by default. (#199308)

This commit is contained in:
lntue 2026-05-22 21:45:01 -04:00 committed by GitHub
parent cd1baf3cdc
commit 387a7385ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
86 changed files with 100 additions and 100 deletions

View file

@ -40,7 +40,7 @@ public:
using AddFunc = OutType (*)(InType, InType);
void test_subnormal_range(AddFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr InStorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<InStorageType>((IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) /
COUNT),
@ -57,7 +57,7 @@ public:
}
void test_normal_range(AddFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr InStorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<InStorageType>((IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT),
InStorageType(1));

View file

@ -70,7 +70,7 @@ public:
}
void testRange(CeilFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -35,7 +35,7 @@ public:
}
void testRange(CopySignFunc func) {
constexpr StorageType COUNT = 100'000;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = FPBits(v).get_val();

View file

@ -39,7 +39,7 @@ public:
using DivFunc = OutType (*)(InType, InType);
void test_subnormal_range(DivFunc func) {
constexpr InStorageType COUNT = 100'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType STEP =
(IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
for (InStorageType i = 0, v = 0, w = IN_MAX_SUBNORMAL_U; i <= COUNT;
@ -53,7 +53,7 @@ public:
}
void test_normal_range(DivFunc func) {
constexpr InStorageType COUNT = 100'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
for (InStorageType i = 0, v = 0, w = IN_MAX_NORMAL_U; i <= COUNT;
++i, v += STEP, w -= STEP) {

View file

@ -37,7 +37,7 @@ public:
}
void testRange(FabsFunc func) {
constexpr StorageType COUNT = 100'000;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = FPBits(v).get_val();

View file

@ -64,7 +64,7 @@ public:
void test_in_range(FuncPtr func) {
constexpr StorageType STORAGE_MAX =
LIBC_NAMESPACE::cpp::numeric_limits<StorageType>::max();
constexpr StorageType COUNT = 100'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
++i, v += STEP, w -= STEP) {

View file

@ -60,7 +60,7 @@ public:
}
void testRange(FMaxFunc func) {
constexpr StorageType COUNT = 100'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
++i, v += STEP, w -= STEP) {

View file

@ -61,7 +61,7 @@ public:
}
void testRange(FMinFunc func) {
constexpr StorageType COUNT = 100'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
++i, v += STEP, w -= STEP) {

View file

@ -70,7 +70,7 @@ public:
}
void testRange(FloorFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -58,7 +58,7 @@ public:
using FmaFunc = OutType (*)(InType, InType, InType);
void test_subnormal_range(FmaFunc func) {
constexpr InStorageType COUNT = 10'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType RAW_STEP =
(IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP);
@ -76,7 +76,7 @@ public:
}
void test_normal_range(FmaFunc func) {
constexpr InStorageType COUNT = 10'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType RAW_STEP =
(IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP);

View file

@ -95,7 +95,7 @@ public:
void testRange(FrexpFunc func) {
using StorageType = typename FPBits::StorageType;
constexpr StorageType COUNT = 100'000;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = FPBits(v).get_val();

View file

@ -70,7 +70,7 @@ public:
}
void test_subnormal_range(Func func) {
constexpr StorageType COUNT = 10'001;
constexpr StorageType COUNT = 1'231;
constexpr unsigned SCALE = (sizeof(T) < 4) ? 1 : 4;
for (unsigned scale = 0; scale < SCALE; ++scale) {
StorageType max_value = static_cast<StorageType>(MAX_SUBNORMAL << scale);
@ -95,7 +95,7 @@ public:
}
void test_normal_range(Func func) {
constexpr StorageType COUNT = 10'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = (MAX_NORMAL - MIN_NORMAL) / COUNT;
for (int signs = 0; signs < 4; ++signs) {
for (StorageType v = MIN_NORMAL, w = MAX_NORMAL;

View file

@ -80,7 +80,7 @@ public:
using StorageType = typename FPBits::StorageType;
constexpr StorageType MIN_SUBNORMAL = FPBits::min_subnormal().uintval();
constexpr StorageType MAX_SUBNORMAL = FPBits::max_subnormal().uintval();
constexpr StorageType COUNT = 10'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = (MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT;
for (StorageType v = MIN_SUBNORMAL; v <= MAX_SUBNORMAL; v += STEP) {
T x = FPBits(v).get_val();
@ -99,7 +99,7 @@ public:
using StorageType = typename FPBits::StorageType;
constexpr StorageType MIN_NORMAL = FPBits::min_normal().uintval();
constexpr StorageType MAX_NORMAL = FPBits::max_normal().uintval();
constexpr StorageType COUNT = 10'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = (MAX_NORMAL - MIN_NORMAL) / COUNT;
for (StorageType v = MIN_NORMAL; v <= MAX_NORMAL; v += STEP) {
T x = FPBits(v).get_val();

View file

@ -74,7 +74,7 @@ public:
void testRange(LogbFunc func) {
using StorageType = typename FPBits::StorageType;
constexpr StorageType COUNT = 100'000;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = FPBits(v).get_val();

View file

@ -86,7 +86,7 @@ public:
}
void testRange(ModfFunc func) {
constexpr StorageType COUNT = 100'000;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
T x = FPBits(v).get_val();

View file

@ -48,7 +48,7 @@ public:
using MulFunc = OutType (*)(InType, InType);
void test_subnormal_range(MulFunc func) {
constexpr InStorageType COUNT = 10'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType STEP =
(IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
LIBC_NAMESPACE::srand(1);
@ -68,7 +68,7 @@ public:
}
void test_normal_range(MulFunc func) {
constexpr InStorageType COUNT = 10'001;
constexpr InStorageType COUNT = 1'231;
constexpr InStorageType STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
LIBC_NAMESPACE::srand(1);
for (int signs = 0; signs < 4; signs++) {

View file

@ -70,7 +70,7 @@ public:
}
void test_subnormal_range(NearbyIntFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
const StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
StorageType(1));
@ -85,7 +85,7 @@ public:
}
void test_normal_range(NearbyIntFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
const StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_NORMAL - MIN_NORMAL) / COUNT),
StorageType(1));

View file

@ -104,7 +104,7 @@ public:
}
void testSubnormalRange(RIntFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
StorageType(1));
@ -119,7 +119,7 @@ public:
}
void testNormalRange(RIntFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_NORMAL - MIN_NORMAL) / COUNT),
StorageType(1));

View file

@ -104,7 +104,7 @@ public:
}
void testSubnormalRange(RemQuoFunc func) {
constexpr StorageType COUNT = 100'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = (MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT;
for (StorageType v = MIN_SUBNORMAL, w = MAX_SUBNORMAL;
v <= MAX_SUBNORMAL && w >= MIN_SUBNORMAL; v += STEP, w -= STEP) {
@ -117,7 +117,7 @@ public:
}
void testNormalRange(RemQuoFunc func) {
constexpr StorageType COUNT = 1'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = (MAX_NORMAL - MIN_NORMAL) / COUNT;
for (StorageType v = MIN_NORMAL, w = MAX_NORMAL;
v <= MAX_NORMAL && w >= MIN_NORMAL; v += STEP, w -= STEP) {

View file

@ -72,7 +72,7 @@ public:
}
void testRange(RoundEvenFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -70,7 +70,7 @@ public:
}
void testRange(RoundFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -240,7 +240,7 @@ public:
}
void testSubnormalRange(RoundToIntegerFunc func) {
constexpr int COUNT = 1'000'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
StorageType(1));
@ -284,7 +284,7 @@ public:
if (sizeof(IntType) > sizeof(long))
return;
constexpr int COUNT = 1'000'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_NORMAL - MIN_NORMAL) / COUNT),
StorageType(1));

View file

@ -39,7 +39,7 @@ public:
}
// Even sampling across all subnormals.
constexpr StorageType COUNT = 200'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = HIDDEN_BIT / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
InType x = FPBits(i).get_val();
@ -49,7 +49,7 @@ public:
// Positive normal range sampling: skip NaNs and negative values.
void test_normal_range(RsqrtFunc func) {
constexpr StorageType COUNT = 200'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
FPBits x_bits(v);

View file

@ -32,7 +32,7 @@ public:
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sqrt, x, func(x), 0.5);
}
constexpr StorageType COUNT = 200'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = HIDDEN_BIT / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
InType x = FPBits(i).get_val();
@ -41,7 +41,7 @@ public:
}
void test_normal_range(SqrtFunc func) {
constexpr StorageType COUNT = 200'001;
constexpr StorageType COUNT = 1'231;
constexpr StorageType STEP = STORAGE_MAX / COUNT;
for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
FPBits x_bits(v);

View file

@ -40,7 +40,7 @@ public:
using SubFunc = OutType (*)(InType, InType);
void test_subnormal_range(SubFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr InStorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<InStorageType>((IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) /
COUNT),
@ -57,7 +57,7 @@ public:
}
void test_normal_range(SubFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr InStorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<InStorageType>((IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT),
InStorageType(1));

View file

@ -70,7 +70,7 @@ public:
}
void testRange(TruncFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -25,7 +25,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LIBC_NAMESPACE::testing::tlog;
TEST_F(LlvmLibcAcosTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'451;
constexpr uint64_t COUNT = 1'231;
uint64_t START = FPBits(0x1.0p-60).uintval();
uint64_t STOP = FPBits(1.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -47,7 +47,7 @@ TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAcosfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -44,7 +44,7 @@ TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAcoshfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -16,7 +16,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAcospifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAcospifTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
// Test in [-1, 1]
const uint32_t STEP = 0x3F800000 / COUNT; // step through [0, 1.0f] in bits
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {

View file

@ -25,7 +25,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LIBC_NAMESPACE::testing::tlog;
TEST_F(LlvmLibcAsinTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'451;
constexpr uint64_t COUNT = 1'231;
uint64_t START = FPBits(0x1.0p-60).uintval();
uint64_t STOP = FPBits(1.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -45,7 +45,7 @@ TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAsinfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -43,7 +43,7 @@ TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAsinhfTest, InFloatRange) {
constexpr uint32_t COUNT = 1'001;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -25,7 +25,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LIBC_NAMESPACE::testing::tlog;
TEST_F(LlvmLibcAsinpiTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'451;
constexpr uint64_t COUNT = 1'231;
uint64_t START = FPBits(0x1.0p-60).uintval();
uint64_t STOP = FPBits(1.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -16,7 +16,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LlvmLibcAsinpifTest = LIBC_NAMESPACE::testing::FPTest<float>;
TEST_F(LlvmLibcAsinpifTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
// Test in [-1, 1]
const uint32_t STEP = 0x3F800000 / COUNT; // step through [0, 1.0f] in bits
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {

View file

@ -19,7 +19,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LIBC_NAMESPACE::testing::tlog;
TEST_F(LlvmLibcAtanTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'451;
constexpr uint64_t COUNT = 1'231;
uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p-60).uintval();
uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p60).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -51,7 +51,7 @@ TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAtanfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
const uint32_t STEP = FPBits(inf).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -101,7 +101,7 @@ TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcAtanhfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
const uint32_t STEP = FPBits(1.0f).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -27,7 +27,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
using LIBC_NAMESPACE::testing::tlog;
TEST_F(LlvmLibcCbrtTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'451;
constexpr uint64_t COUNT = 1'231;
uint64_t START = FPBits(1.0).uintval();
uint64_t STOP = FPBits(8.0).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -18,7 +18,7 @@ using LlvmLibcCbrtfTest = LIBC_NAMESPACE::testing::FPTest<float>;
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcCbrtfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
const uint32_t STEP = FPBits(inf).uintval() / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -69,7 +69,7 @@ TEST_F(LlvmLibcCosTest, TrickyInputs) {
}
TEST_F(LlvmLibcCosTest, InDoubleRange) {
constexpr uint64_t COUNT = 1'234'51;
constexpr uint64_t COUNT = 1'231;
uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p-50).uintval();
uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p200).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -24,7 +24,7 @@ float cosf_fast(float x) {
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcCosfFloatTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -48,7 +48,7 @@ TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcCosfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -52,7 +52,7 @@ TEST_F(LlvmLibcCoshfTest, Overflow) {
}
TEST_F(LlvmLibcCoshfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -50,7 +50,7 @@ TEST_F(LlvmLibcErffTest, TrickyInputs) {
}
TEST_F(LlvmLibcErffTest, InFloatRange) {
constexpr uint32_t COUNT = 234561;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t START = 0; // 0
constexpr uint32_t STOP = 0x4080'0000U; // 4.0f

View file

@ -102,7 +102,7 @@ TEST_F(LlvmLibcExp10fTest, TrickyInputs) {
}
TEST_F(LlvmLibcExp10fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -82,7 +82,7 @@ TEST_F(LlvmLibcExp10m1fTest, TrickyInputs) {
}
TEST_F(LlvmLibcExp10m1fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -104,7 +104,7 @@ TEST_F(LlvmLibcExp2fTest, Underflow) {
}
TEST_F(LlvmLibcExp2fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -50,7 +50,7 @@ TEST_F(LlvmLibcExp2m1fTest, TrickyInputs) {
}
TEST_F(LlvmLibcExp2m1fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -105,7 +105,7 @@ TEST_F(LlvmLibcExpfTest, Borderline) {
}
TEST_F(LlvmLibcExpfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -114,7 +114,7 @@ TEST_F(LlvmLibcExpm1fTest, Borderline) {
}
TEST_F(LlvmLibcExpm1fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -85,7 +85,7 @@ TEST_F(LlvmLibcLog10Test, AllExponents) {
}
TEST_F(LlvmLibcLog10Test, InDoubleRange) {
constexpr uint64_t COUNT = 1'001;
constexpr uint64_t COUNT = 1'231;
constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL; // 4.0
// constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL; // 1.0

View file

@ -71,7 +71,7 @@ TEST_F(LlvmLibcLog10fTest, TrickyInputs) {
}
TEST_F(LlvmLibcLog10fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -87,7 +87,7 @@ TEST_F(LlvmLibcLog1pTest, AllExponents) {
}
TEST_F(LlvmLibcLog1pTest, InDoubleRange) {
constexpr uint64_t COUNT = 4501;
constexpr uint64_t COUNT = 1'231;
auto test = [&](uint64_t start, uint64_t stop,
mpfr::RoundingMode rounding_mode) {

View file

@ -75,7 +75,7 @@ TEST_F(LlvmLibcLog1pfTest, TrickyInputs) {
}
TEST_F(LlvmLibcLog1pfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -77,7 +77,7 @@ TEST_F(LlvmLibcLog2Test, AllExponents) {
}
TEST_F(LlvmLibcLog2Test, InDoubleRange) {
constexpr uint64_t COUNT = 1'001;
constexpr uint64_t COUNT = 1'231;
constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL; // 4.0
// constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL; // 1.0

View file

@ -46,7 +46,7 @@ TEST_F(LlvmLibcLog2fTest, TrickyInputs) {
}
TEST_F(LlvmLibcLog2fTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -82,7 +82,7 @@ TEST_F(LlvmLibcLogTest, AllExponents) {
}
TEST_F(LlvmLibcLogTest, InDoubleRange) {
constexpr uint64_t COUNT = 234561;
constexpr uint64_t COUNT = 1'231;
constexpr uint64_t START = 0x3FD0'0000'0000'0000ULL; // 0.25
constexpr uint64_t STOP = 0x4010'0000'0000'0000ULL; // 4.0
// constexpr uint64_t START = 0x3FF0'0000'0000'0000ULL; // 1.0

View file

@ -88,7 +88,7 @@ TEST_F(LlvmLibcLogfTest, TrickyInputs) {
}
TEST_F(LlvmLibcLogfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -58,7 +58,7 @@ TEST_F(LlvmLibcSinTest, TrickyInputs) {
}
TEST_F(LlvmLibcSinTest, InDoubleRange) {
constexpr uint64_t COUNT = 1'234'51;
constexpr uint64_t COUNT = 1'231;
uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p-50).uintval();
uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p200).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -110,7 +110,7 @@ TEST_F(LlvmLibcSincosTest, TrickyInputs) {
}
TEST_F(LlvmLibcSincosTest, InDoubleRange) {
constexpr uint64_t COUNT = 123'41;
constexpr uint64_t COUNT = 1'231;
uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p-50).uintval();
uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p200).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -101,7 +101,7 @@ TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcSinCosfTest, InFloatRange) {
constexpr uint32_t COUNT = 1'001;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -24,7 +24,7 @@ float sinf_fast(float x) {
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcSinfFloatTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -53,7 +53,7 @@ TEST_F(LlvmLibcSinfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcSinfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -45,7 +45,7 @@ TEST_F(LlvmLibcSinhfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcSinhfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -36,7 +36,7 @@ public:
}
void testRange(CopySignFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -63,7 +63,7 @@ public:
void test_in_range(FuncPtr func) {
constexpr StorageType STORAGE_MAX =
LIBC_NAMESPACE::cpp::numeric_limits<StorageType>::max();
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -56,7 +56,7 @@ public:
}
void testRange(FMaxFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -69,7 +69,7 @@ public:
}
void testRange(FMaximumMagNumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -57,7 +57,7 @@ public:
}
void testRange(FMaximumMagFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -68,7 +68,7 @@ public:
}
void testRange(FMaximumNumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -56,7 +56,7 @@ public:
}
void testRange(FMaximumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -56,7 +56,7 @@ public:
}
void testRange(FMinFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -69,7 +69,7 @@ public:
}
void testRange(FMinimumMagNumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -57,7 +57,7 @@ public:
}
void testRange(FMinimumMagFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -68,7 +68,7 @@ public:
}
void testRange(FMinimumNumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -56,7 +56,7 @@ public:
}
void testRange(FMinimumFunc func) {
constexpr int COUNT = 100'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0, w = STORAGE_MAX;

View file

@ -78,7 +78,7 @@ public:
void test_subnormal_range(Func func) {
constexpr StorageType MIN_SUBNORMAL = FPBits::min_subnormal().uintval();
constexpr StorageType MAX_SUBNORMAL = FPBits::max_subnormal().uintval();
constexpr int COUNT = 10'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
StorageType(1));
@ -98,7 +98,7 @@ public:
void test_normal_range(Func func) {
constexpr StorageType MIN_NORMAL = FPBits::min_normal().uintval();
constexpr StorageType MAX_NORMAL = FPBits::max_normal().uintval();
constexpr int COUNT = 10'001;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_NORMAL - MIN_NORMAL) / COUNT),
StorageType(1));

View file

@ -70,7 +70,7 @@ public:
void testRange(LogbFunc func) {
using StorageType = typename FPBits::StorageType;
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -90,7 +90,7 @@ public:
}
void testRange(ModfFunc func) {
constexpr int COUNT = 100'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
StorageType v = 0;

View file

@ -118,7 +118,7 @@ public:
void testSubnormalRange(RoundToIntegerFunc func) {
// Arbitrary, trades off completeness with testing time (esp. on failure)
constexpr int COUNT = 1'000;
constexpr int COUNT = 1'231;
constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
static_cast<StorageType>((MAX_SUBNORMAL - MIN_SUBNORMAL) / COUNT),
StorageType(1));

View file

@ -67,7 +67,7 @@ TEST_F(LlvmLibcTanTest, TrickyInputs) {
}
TEST_F(LlvmLibcTanTest, InDoubleRange) {
constexpr uint64_t COUNT = 1'234'51;
constexpr uint64_t COUNT = 1'231;
uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p-50).uintval();
uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(0x1.0p200).uintval();
uint64_t STEP = (STOP - START) / COUNT;

View file

@ -48,7 +48,7 @@ TEST_F(LlvmLibcTanfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcTanfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -37,7 +37,7 @@ TEST_F(LlvmLibcTanhfTest, SpecialNumbers) {
}
TEST_F(LlvmLibcTanhfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'001;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -115,7 +115,7 @@ TEST_F(LlvmLibcVecExpfTest, Borderline) {
}
TEST_F(LlvmLibcVecExpfTest, InFloatRange) {
constexpr uint32_t COUNT = 100'000;
constexpr uint32_t COUNT = 1'231;
constexpr uint32_t STEP = UINT32_MAX / COUNT;
for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
float x = FPBits(v).get_val();

View file

@ -19,7 +19,7 @@ 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;
constexpr uint32_t COUNT = 1'231;
FPBits bits(0.0l);
bits.set_biased_exponent(FPBits::MAX_BIASED_EXPONENT);