[libc-commits] [libc] [libc][math][c23] Add {frexp, ilogb, ldexp, llogb, logb, modf}f16 C23 math functions (PR #94758)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 7 07:27:39 PDT 2024
- Previous message: [libc-commits] [libc] [libc][math][c23] Add {frexp, ilogb, ldexp, llogb, logb, modf}f16 C23 math functions (PR #94758)
- Next message: [libc-commits] [libc] [libc][math][c23] Add {frexp, ilogb, ldexp, llogb, logb, modf}f16 C23 math functions (PR #94758)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
================
@@ -94,10 +96,12 @@ class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
void test_normal_range(Func func) {
constexpr StorageType MIN_NORMAL = FPBits::min_normal().uintval();
constexpr StorageType MAX_NORMAL = FPBits::max_normal().uintval();
- constexpr StorageType COUNT = 10'001;
- constexpr StorageType STEP = (MAX_NORMAL - MIN_NORMAL) / COUNT;
+ constexpr int COUNT = 10'001;
+ constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
+ static_cast<StorageType>((MAX_NORMAL - MIN_NORMAL) / COUNT),
+ StorageType(1));
----------------
overmighty wrote:
Here, `COUNT` was small enough and `MAX_NORMAL - MIN_NORMAL` large enough for `STEP` to be > 0 for `float16`/`uint16_t`, but I thought it wouldn't hurt to also do the `max(..., 1)` change here anyway.
https://github.com/llvm/llvm-project/pull/94758
- Previous message: [libc-commits] [libc] [libc][math][c23] Add {frexp, ilogb, ldexp, llogb, logb, modf}f16 C23 math functions (PR #94758)
- Next message: [libc-commits] [libc] [libc][math][c23] Add {frexp, ilogb, ldexp, llogb, logb, modf}f16 C23 math functions (PR #94758)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the libc-commits
mailing list