[libcxx-commits] [libcxx] [libc++] Move std::abs into __math/abs.h (PR #139586)

Devon Loehr via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 26 07:18:00 PDT 2025


DKLoehr wrote:

As a heads up, after this PR we found that some of the template/overload resolution for `abs` was different. In tensorflow, [previously we had](https://github.com/tensorflow/tensorflow/blob/2d754fba94bcb70d564d3f274704fbd1cbdba1d5/tensorflow/lite/kernels/elementwise.cc#L302) `std::abs<float>`. After this change, we had to [change it](https://github.com/tensorflow/tensorflow/blob/5334b804c7c4eff73bcee5d710e844c45c7ca465/tensorflow/lite/kernels/elementwise.cc#L303) to  `[](float f) { return std::abs(f); }`, or use a `static_cast` to the right function type.

For more context, see https://crbug.com/427716648. Totally fixable, but it took a little while to figure out the fix.

https://github.com/llvm/llvm-project/pull/139586


More information about the libcxx-commits mailing list