Skip to content

Commit cad8352

Browse files
authored
[libc][math][c23] fixing dfmal for rv32 (#101763)
1 parent 400c7c7 commit cad8352

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libc/test/src/math/smoke/FmaTest.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ class FmaTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
6767
out.min_normal));
6868

6969
if constexpr (sizeof(OutType) < sizeof(InType)) {
70+
InFPBits tmp = InFPBits::one();
71+
tmp.set_biased_exponent(InFPBits::EXP_BIAS - InFPBits::FRACTION_LEN - 1);
72+
InType reciprocal_value = tmp.get_val();
73+
7074
InType v = InFPBits(static_cast<InStorageType>(IN_MIN_NORMAL_U +
7175
InStorageType(1)))
7276
.get_val();
73-
EXPECT_FP_EQ(
74-
out.min_normal,
75-
func(InType(1) / InType(IN_MIN_NORMAL_U << 1), v, out.min_normal));
77+
EXPECT_FP_EQ(out.min_normal, func(reciprocal_value, v, out.min_normal));
7678
}
7779

7880
// Test overflow.

0 commit comments

Comments
 (0)