From 7751d487ed24f95fc29915803c0eae53a554eb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20L=C3=BCke?= Date: Wed, 25 Dec 2024 03:19:00 +0100 Subject: [PATCH] math: add make_quiet_nan() --- include/mesytec-mnode/mnode_math.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/mesytec-mnode/mnode_math.h b/include/mesytec-mnode/mnode_math.h index a9693c2..0119f8e 100644 --- a/include/mesytec-mnode/mnode_math.h +++ b/include/mesytec-mnode/mnode_math.h @@ -2,6 +2,7 @@ #define C536E080_25D7_476D_B8E3_25912B9CFC3B #include +#include namespace mesytec::mnode { @@ -13,6 +14,13 @@ inline int64_t round_up(int64_t n, int64_t p) return (n + mask) & ~mask; } +inline double make_quiet_nan() +{ + double result = std::numeric_limits::quiet_NaN(); + assert(((uintptr_t)(result) & 0xffffffff) == 0); + return result; +} + } #endif /* C536E080_25D7_476D_B8E3_25912B9CFC3B */