This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add implementations of round and roundf.
ClosedPublic

Authored by sivachandra on May 28 2020, 11:25 PM.

Diff Detail

Event Timeline

sivachandra created this revision.May 28 2020, 11:25 PM
asteinhauser accepted this revision.Jun 8 2020, 11:34 AM
asteinhauser added a subscriber: asteinhauser.
asteinhauser added inline comments.
libc/utils/FPUtil/FloatOperations.h
225

Missing comma:
// If x is infinity, NaN or zero, return it.

237–243

Is this necessary?

This revision is now accepted and ready to land.Jun 8 2020, 11:34 AM

Address comment.

sivachandra marked 2 inline comments as done.Jun 9 2020, 10:50 PM
sivachandra added inline comments.
libc/utils/FPUtil/FloatOperations.h
237–243

After line 250, we want exponent to be less than mantissa width, but greater than 0. So, we handle these two special cases of -1 and -2 separately.

sivachandra marked an inline comment as done.Jun 9 2020, 10:52 PM
sivachandra added inline comments.
libc/utils/FPUtil/FloatOperations.h
237–243

Actually, exponent is greater than or equal to zero and less than mantissa width after line 250.

This revision was automatically updated to reflect the committed changes.