Page MenuHomePhabricator

[libc] Add implementations of lround[f|l] and llround[f|l].
ClosedPublic

Authored by sivachandra on Dec 10 2020, 12:18 AM.

Details

Summary

A new function to MPFRWrapper has been added, which is used to set up
the unit tests.

Diff Detail

Event Timeline

sivachandra created this revision.Dec 10 2020, 12:18 AM
sivachandra requested review of this revision.Dec 10 2020, 12:18 AM

Remove aarch64 entrypoints as we do not yet have exception support for aarch64.

Add an explicit overflow test.

lntue added inline comments.Dec 10 2020, 8:09 AM
libc/utils/FPUtil/NearestIntegerOperations.h
168

For overflow values, I think it makes more sense to saturate to LONG_(MIN/MAX), LLONG_(MIN/MAX) accordingly, as I doubt most user codes will check for FE_INVALID, and a small floating point error making the results jump between INT_(MIN/MAX) and 0 might be surprising.

Return max integer or min integer value on overflow.

sivachandra marked an inline comment as done.Dec 10 2020, 2:42 PM
lntue accepted this revision.Dec 11 2020, 6:27 AM
This revision is now accepted and ready to land.Dec 11 2020, 6:27 AM
This revision was landed with ongoing or failed builds.Dec 11 2020, 11:12 AM
This revision was automatically updated to reflect the committed changes.