summaryrefslogtreecommitdiff
path: root/src/Fl_Valuator.cxx
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2001-01-21 06:00:59 +0000
committerBill Spitzak <spitzak@gmail.com>2001-01-21 06:00:59 +0000
commitb7496f2c59e2765ffa641f66f274947793f4d133 (patch)
treedabc73c51f201db59483a82efd3119d69480a3a1 /src/Fl_Valuator.cxx
parent3a0c70d82ea1dbe94c4a7ebd198e11b5f00ef2c2 (diff)
"accu-timer": some changes to repeat_timeout that seem to make it accurate
on Unix and Win32 at speeds up to 500000 timeouts/second (and 700000 on Linux), and within about .001% as accurate as the system clock. Fix to Fl_Valuator::step() by Guillermo Andrade. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1354 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Valuator.cxx')
-rw-r--r--src/Fl_Valuator.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Fl_Valuator.cxx b/src/Fl_Valuator.cxx
index b066514b4..eaea57c2a 100644
--- a/src/Fl_Valuator.cxx
+++ b/src/Fl_Valuator.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Valuator.cxx,v 1.5.2.2 2000/06/05 21:20:58 mike Exp $"
+// "$Id: Fl_Valuator.cxx,v 1.5.2.3 2001/01/21 06:00:59 spitzak Exp $"
//
// Valuator widget for the Fast Light Tool Kit (FLTK).
//
@@ -41,13 +41,13 @@ Fl_Valuator::Fl_Valuator(int X, int Y, int W, int H, const char* L)
B = 1;
}
-const double epsilon = 1e-12 ;
+const double epsilon = 4.66e-10;
void Fl_Valuator::step(double s) {
if (s < 0) s = -s;
A = rint(s);
B = 1;
- while (fabs(s-A/B) > epsilon) {B *= 10; A = rint(s*B);}
+ while (fabs(s-A/B) > epsilon && B<=(0x7fffffff/10)) {B *= 10; A = rint(s*B);}
}
void Fl_Valuator::precision(int p) {
@@ -123,5 +123,5 @@ int Fl_Valuator::format(char* buffer) {
}
//
-// End of "$Id: Fl_Valuator.cxx,v 1.5.2.2 2000/06/05 21:20:58 mike Exp $".
+// End of "$Id: Fl_Valuator.cxx,v 1.5.2.3 2001/01/21 06:00:59 spitzak Exp $".
//