From d13573c930efc7330fcfd25d1df4f092cbc05ab1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 4 Mar 2024 06:51:39 +0100 Subject: oops, the last accurate double is 2^53 and not 2^54! --- src/timer.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/timer.hpp') diff --git a/src/timer.hpp b/src/timer.hpp index faf92a3e..6e9bd651 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -34,7 +34,7 @@ struct Ns requires std::is_same_v explicit constexpr Ns(T x) : stamp{} { - constexpr double max{uint64_t{1} << 54}; + constexpr double max{uint64_t{1} << 53}; fm_assert(x >= 0); fm_assert(x <= max); stamp = uint64_t(x); @@ -50,7 +50,7 @@ struct Ns requires (std::is_same_v) friend Ns operator*(const Ns& lhs, T b) { - constexpr double max{uint64_t{1} << 54}; + constexpr double max{uint64_t{1} << 53}; auto a = lhs.stamp; fm_assert(b >= 0); fm_assert(b <= max); @@ -65,7 +65,7 @@ struct Ns requires (std::is_same_v) static Ns from_nonzero(T seconds) { - constexpr double max{uint64_t{1} << 54}; + constexpr double max{uint64_t{1} << 53}; fm_assert(seconds >= 0); fm_assert(seconds <= max); return Ns((uint64_t)seconds); -- cgit v1.2.3