-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc][math] Update getpayload and fmul with NaN inputs. #99812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8ef05d3
0570965
dbd831d
1e4d04e
fb6525d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,23 +38,8 @@ class MulTest : public LIBC_NAMESPACE::testing::FEnvSafeTest { | |
EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(sNaN, sNaN), FE_INVALID); | ||
|
||
InType qnan_42 = InFPBits::quiet_nan(Sign::POS, 0x42).get_val(); | ||
EXPECT_FP_EQ(InType(0x42.0p+0), | ||
LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, zero))); | ||
EXPECT_FP_EQ(InType(0x42.0p+0), | ||
LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_42))); | ||
|
||
if constexpr (sizeof(OutType) < sizeof(InType)) { | ||
InStorageType max_payload = InFPBits::FRACTION_MASK >> 1; | ||
InType qnan_max = InFPBits::quiet_nan(Sign::POS, max_payload).get_val(); | ||
EXPECT_FP_EQ(zero, | ||
LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, zero))); | ||
EXPECT_FP_EQ(zero, | ||
LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_max))); | ||
EXPECT_FP_EQ(InType(0x42.0p+0), | ||
LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, qnan_42))); | ||
EXPECT_FP_EQ(InType(0x42.0p+0), | ||
LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, qnan_max))); | ||
} | ||
EXPECT_FP_IS_NAN(func(qnan_42, zero)); | ||
EXPECT_FP_IS_NAN(func(zero, qnan_42)); | ||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure you don't want to check the payload? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I don't think we need to be that strict on NaN propagation when it is underspecified in the standards, as long as the NaN semantic is preserved. |
||
|
||
EXPECT_FP_EQ(inf, func(inf, InType(1.0))); | ||
EXPECT_FP_EQ(neg_inf, func(neg_inf, InType(1.0))); | ||
|
Uh oh!
There was an error while loading. Please reload this page.