math: add make_quiet_nan()

This commit is contained in:
Florian Lüke 2024-12-25 03:19:00 +01:00
parent 6d93197f86
commit 7751d487ed

View file

@ -2,6 +2,7 @@
#define C536E080_25D7_476D_B8E3_25912B9CFC3B #define C536E080_25D7_476D_B8E3_25912B9CFC3B
#include <cstdint> #include <cstdint>
#include <limits>
namespace mesytec::mnode namespace mesytec::mnode
{ {
@ -13,6 +14,13 @@ inline int64_t round_up(int64_t n, int64_t p)
return (n + mask) & ~mask; return (n + mask) & ~mask;
} }
inline double make_quiet_nan()
{
double result = std::numeric_limits<double>::quiet_NaN();
assert(((uintptr_t)(result) & 0xffffffff) == 0);
return result;
}
} }
#endif /* C536E080_25D7_476D_B8E3_25912B9CFC3B */ #endif /* C536E080_25D7_476D_B8E3_25912B9CFC3B */