Fixes https://github.com/llvm/llvm-project/issues/50806
The new implementation and new tests are both copy-pasted from hypot(a,b,c).
Differential D116295
[libc++] Add missing templated version of `std::lerp` • Quuxplusone on Dec 26 2021, 7:20 PM. Authored by
Details
Fixes https://github.com/llvm/llvm-project/issues/50806 The new implementation and new tests are both copy-pasted from hypot(a,b,c).
Diff Detail
Event Timeline
Comment Actions Seems copy-pasting missed some code improvements and required changes.
Comment Actions Add constexpr, and test it.
Comment Actions Thanks, a few minor points remaining. Otherwise then that LGTM!
Comment Actions LGTM but like @Mordante said, please move the lerp tests to cmath.pass.cpp in a separate NFC commit.
Comment Actions Flatten c.math.lerp/c.math.lerp.pass.cpp to lerp.pass.cpp, to match abs.pass.cpp. If CI is green, imma land this. There may be room for more thorough testing in lerp.pass.cpp, but at least test_lerp() does smoke-test the new overload (with both assert and static_assert). |
The function should be constexpr. Please make sure to also update the test.