diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-16 17:42:46 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-16 17:54:12 +0200 |
commit | d42019e4d15ff62926b1a98b45a0fcd154567620 (patch) | |
tree | 45932be0a093af0df689cc490219734bb234dec3 /options/slider.cpp | |
parent | 190ec92ac66c4b2c44d692be9b861ec98853355a (diff) |
options/slider: use double precision
Made Accela slider inaccurate.
Diffstat (limited to 'options/slider.cpp')
-rw-r--r-- | options/slider.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/options/slider.cpp b/options/slider.cpp index fe34d8e6..001e8104 100644 --- a/options/slider.cpp +++ b/options/slider.cpp @@ -38,7 +38,7 @@ bool slider_value::operator==(const slider_value& v) const { using std::fabs; - static constexpr float eps = float(1e-2 + 2.5e-3); + static constexpr double eps = 2e-3; #if 1 return (fabs(v.cur_ - cur_) < eps && @@ -55,7 +55,7 @@ slider_value slider_value::update_from_slider(int pos, int q_min, int q_max) con const int q_diff = q_max - q_min; const double sv_pos = q_diff == 0 - ? -1e6 + ? 0 : (((pos - q_min) * (v.max() - v.min())) / q_diff + v.min()); if (sv_pos < v.min()) @@ -80,9 +80,9 @@ QT_BEGIN_NAMESPACE QDataStream& operator << (QDataStream& out, const options::slider_value& v) { - out << float(v.cur()) - << float(v.min()) - << float(v.max()); + out << v.cur() + << v.min() + << v.max(); return out; } @@ -93,7 +93,7 @@ QDebug operator << (QDebug dbg, const options::slider_value& val) QDataStream& operator >> (QDataStream& in, options::slider_value& v) { - float cur = 0, min = 0, max = 0; + double cur = 0, min = 0, max = 0; in >> cur >> min >> max; v = options::slider_value(cur, min, max); return in; |