Math constants are declared using the const keyword, but it doesn't guarantee that no memory will be allocated for them. To speed up operations, defining these constants as constexpr ensures the fastest possible access to them during runtime.
I also updated (float)HUGE_VAL to use std::numeric_limits<float>::infinity(), which provides better cross-platform guarantee of its value.
Describe the issue (if no issue has been made)
Math constants are declared using the
const
keyword, but it doesn't guarantee that no memory will be allocated for them. To speed up operations, defining these constants asconstexpr
ensures the fastest possible access to them during runtime.I also updated
(float)HUGE_VAL
to usestd::numeric_limits<float>::infinity()
, which provides better cross-platform guarantee of its value.