C++20 introduces standard library header, <numbers>, with definitions in namespace std::numbers
for math constants such as sqrt2
and sqrt3
. It provide inverse values like inv_sqrt3
, but not inv_sqrt2
. Why is inv_sqrt2
missing?
Why is
inv_sqrt2
missing?
The library defines a minimal set of commonly-used constants as precisely as the type will allow. It can be tricky to express (√3)-1 without introducing rounding errors, hence inv_sqrt3
. However, (√2)-1 can easily be expressed as: sqrt2 / 2
, so inv_sqrt2
isn't defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With