[libc-commits] [libc] [libc][math] Add POSIX math constants to math.h header. (PR #149150)

via libc-commits libc-commits at lists.llvm.org
Fri Jul 18 07:38:30 PDT 2025


lntue wrote:

> lgtm. Eventually I want to get all the macros properly listed in `math.yaml` and for ones like these their values could easily be defined directly there. But we can do that as a later refactor.
> 
> It would be good to have at least nominal tests for these too. All the tests really need to do is verify the type of each expression, e.g.
> 
> ```
> static_cast(std::is_same_v<double, decltype(M_PI)>);
> ```
> 
> etc. I don't know if it's worthwhile doing value checks with e.g. comparing some trig function's value where the input constant is something trivial like 0,1,-1.

I added a unit test for M_PI in the test/include folder.

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


More information about the libc-commits mailing list