diff options
| author | OverMighty <its.overmighty@gmail.com> | 2024-06-10 14:38:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-10 08:38:47 -0400 |
| commit | 10cd96dd3315ca466a56a2ace2627e44bdcba333 (patch) | |
| tree | cc144b8402eecfa3f8a9932a8d0ab0f38792b309 /libc/test/src/math/smoke/ModfTest.h | |
| parent | a1c29df5725fc043291258a3af732a72a39b6902 (diff) | |
[libc][math][c23] Add {frexp,ilogb,llogb,logb,modf}f16 C23 math functions (#94758)
Part of #93566.
Diffstat (limited to 'libc/test/src/math/smoke/ModfTest.h')
| -rw-r--r-- | libc/test/src/math/smoke/ModfTest.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libc/test/src/math/smoke/ModfTest.h b/libc/test/src/math/smoke/ModfTest.h index 85db2d6d967b..6226e5d55f40 100644 --- a/libc/test/src/math/smoke/ModfTest.h +++ b/libc/test/src/math/smoke/ModfTest.h @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/CPP/algorithm.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "test/UnitTest/FEnvSafeTest.h" @@ -83,10 +84,12 @@ public: } void testRange(ModfFunc func) { - constexpr StorageType COUNT = 100'000; - constexpr StorageType STEP = STORAGE_MAX / COUNT; - for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) { - FPBits x_bits = FPBits(v); + constexpr int COUNT = 100'000; + constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max( + static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1)); + StorageType v = 0; + for (int i = 0; i <= COUNT; ++i, v += STEP) { + FPBits x_bits(v); if (x_bits.is_zero() || x_bits.is_inf_or_nan()) continue; |
