diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-04 06:51:39 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-05 13:55:06 +0100 |
| commit | d13573c930efc7330fcfd25d1df4f092cbc05ab1 (patch) | |
| tree | faadbb87a0897616c3e9b4e4fd01c9f3cfd89f7a /src/timer.hpp | |
| parent | b59b5bb320309f0d934ab9bc24d35c63b641b169 (diff) | |
oops, the last accurate double is 2^53 and not 2^54!
Diffstat (limited to 'src/timer.hpp')
| -rw-r--r-- | src/timer.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<T, double> 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<T, double>) 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<T, double>) 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); |
