Page MenuHomePhabricator

[libc] Add implementation for hypotf

Authored by lntue on Sep 11 2020, 7:49 AM.



Truncating the sum of squares, and then use shift-and-add algorithm to compute its square root.
Required MPFR testing infra is updated in

Diff Detail

Event Timeline

lntue created this revision.Sep 11 2020, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2020, 7:49 AM
lntue requested review of this revision.Sep 11 2020, 7:49 AM
lntue updated this revision to Diff 291223.Sep 11 2020, 8:08 AM

Fix comments alignment and remove commented tests.

hungptit added inline comments.

Shall we use the return early pattern for this if block?


Does const/constexpr work for these global variables?

lntue marked 2 inline comments as done.Sep 14 2020, 12:41 PM
lntue added inline comments.

The template class FPBits<T> does not support constexpr yet.

lntue updated this revision to Diff 291654.Sep 14 2020, 12:41 PM
lntue marked an inline comment as done.

Change to early return pattern.

sivachandra accepted this revision.Sep 17 2020, 9:05 AM
sivachandra added inline comments.

With other implementations in libc/src, we have followed snake_case. I think we should do that here for consistency.


I understand why the use of a 64-bit integers is required here. But, I would ideally prefer to restrict a function which deals with 32-bit numbers not have to deal with wider numbers. It surely is not a problem on most modern architectures. So, we can revisit if it ever becomes a problem. FWIW, the AOR implementations also switch to double_t for higher precision with intermediate computations.

This revision is now accepted and ready to land.Sep 17 2020, 9:05 AM
lntue marked an inline comment as done.Sep 17 2020, 8:45 PM
lntue updated this revision to Diff 292698.Sep 17 2020, 8:46 PM

Change to snake_case.

This revision was landed with ongoing or failed builds.Sep 17 2020, 8:47 PM
This revision was automatically updated to reflect the committed changes.