summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-06-06 15:22:26 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-06-06 15:23:09 -0400
commit10232447bab6aecd2f939d5adb4e9913d4e1d9c7 (patch)
treed5fb74d6130fecafd47e698056778af522ee70d7
parentf5d8c0f5047a3f71d580cced236a0a1031a386d7 (diff)
xtal: Compensate for floating-point rounding errors when converting to integer value (nw)
-rw-r--r--src/emu/xtal.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/emu/xtal.h b/src/emu/xtal.h
index 4ce24b9323b..684a13c1959 100644
--- a/src/emu/xtal.h
+++ b/src/emu/xtal.h
@@ -49,7 +49,7 @@ public:
constexpr explicit XTAL(double base_clock) : m_base_clock(base_clock), m_current_clock(base_clock) {}
constexpr double dvalue() const noexcept { return m_current_clock; }
- constexpr u32 value() const noexcept { return u32(m_current_clock); }
+ constexpr u32 value() const noexcept { return u32(m_current_clock + 1e-3); }
constexpr double base() const noexcept { return m_base_clock; }
template <typename T> constexpr XTAL operator *(T &&mult) const noexcept { return XTAL(m_base_clock, m_current_clock * mult); }