-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
https://github.com/kthohr/gcem
I've been using this in my projects, and I've found it to be immensely useful. (I am NOT the author nor related to the project) I feel like glm could greatly benefit from breaking away from some of the std math library functions, which are often implemented as non-constexpr functions. This library could improve relevant implementations and pre-computing in a constexpr context.
It's a header only library with no external dependencies. Here's the relevant bullet points from the documentation:
"
GCE-Math (Generalized Constant Expression Math) is a templated C++ library enabling compile-time computation of mathematical functions.
- The library is written in C++11 constexpr format, and is C++11/14/17/20 compatible.
- Continued fraction and series expansions are implemented using recursive templates.
- The gcem:: syntax is identical to that of the C++ standard library (std::).
- Tested and accurate to floating-point precision against the C++ standard library.
- Released under a permissive, non-GPL license.
"
My suggestion would be that we could enable inclusion of this library through a #define, similar to other GLM flags, and that would swap out the std:: calls with gcem:: ones, and also enable the constexpr functions which are not current constexpr (based on the flag). This also simplifies the future implmentation/evolution of glm, especially in constexpr contexts, since there are major pushes going forward in C++ for standardizing on constexpr math functions.