You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes @RobertMassart there are several options for this to work. One of them is to make the constructor from the internal 64-bit representation type to be public. I'll see qhich option is best, and we can discuss further.
Hi Robert (@RobertMassart), I used a standard C++20 function to do a preliminary (yet portable) fix for this. The only real condition is that you need C++ 20 or higher, or use a compiler that has the feature __cpp_lib_bit_cast, as shown in feature-testing.
If you are using a modern GCC or VS2022, this will simply be transparent for you and constexpr-initialization from built-in double will simply just work.
In a cpp header I want to have the following work:
inline constexpr auto gravitational_constant = math::softfloat::float64_t(6.674e-11);
// This will work when it's an integer value
inline constexpr auto gravitational_constant = math::softfloat::float64_t(6);
Just can't use constexpr when it's a double or float.
Is it possible to make this work as an constexpr?
The text was updated successfully, but these errors were encountered: