Skip to content

Commit f118c0f

Browse files
committed
[libc][math][c23] Fix test test failure.
1 parent b69e80e commit f118c0f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libc/test/src/math/FmaTest.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
5858

5959
void test_subnormal_range(FmaFunc func) {
6060
constexpr InStorageType COUNT = 100'001;
61-
constexpr InStorageType STEP =
61+
constexpr InStorageType RAW_STEP =
6262
(IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
63+
constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP);
6364
LIBC_NAMESPACE::srand(1);
6465
for (InStorageType v = IN_MIN_SUBNORMAL_U, w = IN_MAX_SUBNORMAL_U;
6566
v <= IN_MAX_SUBNORMAL_U && w >= IN_MIN_SUBNORMAL_U;
@@ -75,7 +76,9 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
7576

7677
void test_normal_range(FmaFunc func) {
7778
constexpr InStorageType COUNT = 100'001;
78-
constexpr InStorageType STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
79+
constexpr InStorageType RAW_STEP =
80+
(IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
81+
constexpr InStorageType STEP = (RAW_STEP == 0 ? 1 : RAW_STEP);
7982
LIBC_NAMESPACE::srand(1);
8083
for (InStorageType v = IN_MIN_NORMAL_U, w = IN_MAX_NORMAL_U;
8184
v <= IN_MAX_NORMAL_U && w >= IN_MIN_NORMAL_U; v += STEP, w -= STEP) {

0 commit comments

Comments
 (0)