This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix final conversion warnings
ClosedPublic

Authored by michaelrj on Aug 8 2023, 3:28 PM.

Details

Summary

This patch fixes the floating point conversion warnings found with
-Wconversion and -Wno-sign-conversion. These were the last warnings
I found, meaning that once this lands https://reviews.llvm.org/D156630
should be unblocked.

Diff Detail

Event Timeline

michaelrj created this revision.Aug 8 2023, 3:28 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 8 2023, 3:28 PM
michaelrj requested review of this revision.Aug 8 2023, 3:28 PM
mcgrathr added inline comments.Aug 8 2023, 3:42 PM
libc/src/math/generic/tanhf.cpp
59

The literals here use the f suffix to have float type, but then the variable is double.
Should the variable just be float? And I wonder too why it's not constexpr.

lntue added inline comments.Aug 8 2023, 3:57 PM
libc/src/math/generic/tanhf.cpp
59

+1, this should be declared as constexpr float

michaelrj updated this revision to Diff 548392.Aug 8 2023, 4:08 PM
michaelrj marked 2 inline comments as done.

update tanhf signs array

mcgrathr accepted this revision.Aug 8 2023, 5:38 PM

lgtm

This revision is now accepted and ready to land.Aug 8 2023, 5:38 PM
lntue accepted this revision.Aug 8 2023, 8:47 PM
This revision was automatically updated to reflect the committed changes.