<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/130325>130325</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] `modernize-use-std-numbers` ignores some C math functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SunBlack
      </td>
    </tr>
</table>

<pre>
    `modernize-use-std-numbers` ignores C math functions that are not named the same as their C++ counterparts.

Calling following code with:
```
clang-tidy-20 -checks='modernize-use-std-numbers' "test.cpp" -- -std=c++20
```

`test.cpp`:
```cpp
#include <cmath>

float mySqrt3()
{
    return sqrtf(3.0F);
}
```
Doesn't raise a warning. When exchanging the C method `sqrtf` by the C++ method `std::sqrt`:
```cpp
#include <cmath>

float mySqrt3()
{
    return std::sqrt(3.0F);
}
```
You will get:
```
test.cpp:5:12: warning: prefer 'std::numbers::sqrt3_v<float>' to this formula [modernize-use-std-numbers]
 5 |     return std::sqrt(3.0F);
      |            ^~~~~~~~~~~~~~~
 |            std::numbers::sqrt3_v<float>
```

You get also the warning when using the double C method of `sqrt`:
```cpp
#include <cmath>

float mySqrt3()
{
    return sqrt(3.0);
}
```
```
test.cpp:5:12: warning: prefer 'std::numbers::sqrt3' to this formula [modernize-use-std-numbers]
 5 |     return sqrt(3.0);
      |            ^~~~~~~~~
      | std::numbers::sqrt3
```

I think also the non-double C math methods should cause a warning.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VU2P4jgQ_TXFpRTk2CSBQw4BBmnPc1jtaeUklcTbjs34o9new_72kYGmP9DM9GE6aqkDfkW9eu_JJb1XoyGqodhCsV_IGCbr6q_RbLXsHhat7Z9qKNlse3JG_UdZ9JT50Gcmzi05DyVDNRrryOMOZxkmHKLpgrLGY5hkQOkIjQ1o5Ew9honQy5lQpmNSDnfAt8C32NloArmjdMEvgTXAmp3UWpkRB6u1PaW3zvaEJxUmEAkAJbv-sabT0oxZUP1Txhlm3UTdgwexB179mD2vEDgP5MOyOx6Bc8wyTAgQ--5CjLN3jS4fbzUle8clfcka4EKZTseeEMSuS8qA-HIpH7SVAeenr99cEMDXwDfpoNoCaxARHYXoDPpvLgzA12LJDgkitmfU_h2fvSVvgFcBnVSeUOJJOqPMuMQ_JzJI_3aTNGOSL6m_w5nCZHuEkl06lAzbp8vZ1YtXiCRFA6JJ0M-c9U2fX878l414UlrjSOE-CjdvRFOAaHIOonkWJb0eHQ3kEHh1a_sciBsH8fcjiN2ZfZqFVxgshkl5HKybo5YIxfbHwSoSYywQqh1-dMwz8FZxfaD48v-bJwHfYT48xV2Qk44jBZTa23MCrirhKSUn-ufQ9Da2-lV27PAcn0_O_0WjnyTht_v-26y-Z_8rg99Afkbxzsc_El_z8OKjsSZ7MS1dyxfnPPrJRt1jJ-Obu2LR16LfiI1cUJ1Xq1xUghflYqqHfL0pW1n2ss3zMu_Zel3lXZ4PbFOW1bBaqJozXjDBqny9qkSxXHUruaGCr_I2X7N-gBWjWSq91PpxXlo3LpT3kepcMMGLhZYtaX_eQJy_3OLAedpIrk5VWRtHDyumlQ_-5XeCCvq8u16VFXv86MLydqa7rbWITtdTCMez4vwA_DCqMMV22dkZ-CE1v_7Ljs7-Q10AfjhP5IEfrkM91vx7AAAA___bCTMU">