This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add implementation of few floating point manipulation functions.
ClosedPublic

Authored by sivachandra on Jun 4 2020, 12:05 AM.

Details

Summary

Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added.

Diff Detail

Event Timeline

sivachandra created this revision.Jun 4 2020, 12:05 AM
asteinhauser accepted this revision.Jun 8 2020, 2:12 PM
asteinhauser added a subscriber: asteinhauser.

Nice work. I would just make sure that the tests cover all control-flow paths.

libc/test/src/math/frexp_test.cpp
101

I would add one test with a different base than 0.5/-0.5 (e.g. 0.75, input value 24). You can also reduce the amount of 0.5 tests if you want to. The same with the float version.

libc/test/src/math/logb_test.cpp
68

I would add one more test of a value that is not 2^(integer).

libc/test/src/math/modf_test.cpp
86

Wouldn't it be useful to have also one test where the fractional part is non-zero (e.g. 0.5)? The same also for modff.

This revision is now accepted and ready to land.Jun 8 2020, 2:12 PM
sivachandra marked 3 inline comments as done.

Add more tests as suggested by the comments.

Address comments.

This revision was automatically updated to reflect the committed changes.