Page MenuHomePhabricator

[libc] Add implementations of remquo[f|l] and remainder[f|l].

Authored by sivachandra on Aug 26 2020, 5:11 PM.



The implementation is not fully standards compliant in the sense that
errno is not set on error, and floating point exceptions are not raised.

Subnormal range and normal range are tested separately in the tests.

Diff Detail

Event Timeline

sivachandra created this revision.Aug 26 2020, 5:11 PM
sivachandra requested review of this revision.Aug 26 2020, 5:11 PM
lntue added inline comments.Sep 3 2020, 12:32 PM

When the remainder is in the subnormal range, I think the final check below is correct, but with an implicit assumption that the rounding from NormalFloat<T> to T is truncation.
Can you add that to comments, in case we change the rounding NormalFloat<T> to T to the default round-to-nearest, tie-to-even? So that at least we will add more tests for subnormal range to make sure that it still works correctly, even when NormalFloat<T> rounding is updated.

sivachandra marked an inline comment as done.

Add comment as suggested.

Added comment as suggested.

lntue accepted this revision.Sep 3 2020, 9:43 PM
This revision is now accepted and ready to land.Sep 3 2020, 9:43 PM
This revision was landed with ongoing or failed builds.Sep 3 2020, 10:00 PM
This revision was automatically updated to reflect the committed changes.