This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.
ClosedPublic

Authored by lntue on Nov 29 2021, 10:36 AM.

Details

Summary

Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

Diff Detail

Event Timeline

lntue created this revision.Nov 29 2021, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 29 2021, 10:36 AM
lntue requested review of this revision.Nov 29 2021, 10:36 AM
lntue updated this revision to Diff 390746.Nov 30 2021, 9:40 AM

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

lntue retitled this revision from [libc] Fix a bug with negative inputs in hypot implementation. to [libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation..Nov 30 2021, 9:44 AM
lntue edited the summary of this revision. (Show Details)
lntue added a reviewer: zimmermann6.
michaelrj added inline comments.Nov 30 2021, 1:00 PM
libc/utils/MPFRWrapper/MPFRUtils.cpp
315–318 ↗(On Diff #390746)

based on my testing, the tests still pass if you don't update this file, could you add something to explain these changes, and possibly split them off into their own patch?

lntue added inline comments.Dec 1 2021, 7:48 AM
libc/utils/MPFRWrapper/MPFRUtils.cpp
315–318 ↗(On Diff #390746)

This is because without this change, the ULPs are computed off by a factor of 2^(-mantissaWidth), and hence all the tests still pass. As in the comments in line 287-294, the factor that we divide is eps(...) which should be 2^(exponent - mantissaWidth) for normal numbers, and 2^(1 - exponentBias - mantissaWidth) for denormal numbers.

With changes in this file, updated HypotTests without the fix in Hypot.h shall fail. In any case, I split the change in the ULP function to https://reviews.llvm.org/D114726

lntue updated this revision to Diff 391314.Dec 2 2021, 6:47 AM

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

sivachandra accepted this revision.Dec 3 2021, 5:12 AM
This revision is now accepted and ready to land.Dec 3 2021, 5:12 AM
lntue updated this revision to Diff 391632.Dec 3 2021, 7:12 AM

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

lntue updated this revision to Diff 391633.Dec 3 2021, 7:13 AM

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

lntue updated this revision to Diff 391634.Dec 3 2021, 7:14 AM

[libc] Fix bugs with negative and mixed normal/denormal inputs in hypot implementation.

This revision was landed with ongoing or failed builds.Dec 3 2021, 7:14 AM
This revision was automatically updated to reflect the committed changes.