Skip to content

Commit

Permalink
[libc][math][c23] Fix getpayloadf128 smoke test on RV32
Browse files Browse the repository at this point in the history
  • Loading branch information
overmighty committed Aug 2, 2024
1 parent d6649f2 commit 4151b60
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libc/test/src/math/smoke/GetPayloadTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ class GetPayloadTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(0.0), funcWrapper(func, aNaN));
EXPECT_FP_EQ(T(0.0), funcWrapper(func, neg_aNaN));

T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2);
// Essentially this:
// T default_snan_payload = StorageType(1) << (FPBits::SIG_LEN - 2);
// but supports StorageType being a BigInt.
FPBits default_snan_payload_bits = FPBits::one();
default_snan_payload_bits.set_biased_exponent(FPBits::SIG_LEN - 2 +
FPBits::EXP_BIAS);
T default_snan_payload = default_snan_payload_bits.get_val();

EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, sNaN));
EXPECT_FP_EQ(default_snan_payload, funcWrapper(func, neg_sNaN));

Expand Down

0 comments on commit 4151b60

Please sign in to comment.