mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 09:13:58 +08:00
OK, I *definitely* need a remedial math class...
Now compute number of digits required using B / A, and then looping. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2264 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+4
-4
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.3 2002/05/28 00:12:49 easysw Exp $"
|
||||
// "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.4 2002/05/28 00:16:08 easysw Exp $"
|
||||
//
|
||||
// Valuator widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -117,11 +117,11 @@ int Fl_Valuator::format(char* buffer) {
|
||||
double v = value();
|
||||
if (!A) return sprintf(buffer, "%g", v);
|
||||
int i, x;
|
||||
double ab = A * B;
|
||||
for (x = 1, i = 0; x < ab; x *= 10) i++;
|
||||
double ba = B / A;
|
||||
for (x = 1, i = 0; x < ba; x *= 10) i++;
|
||||
return sprintf(buffer, "%.*f", i, v);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.3 2002/05/28 00:12:49 easysw Exp $".
|
||||
// End of "$Id: Fl_Valuator.cxx,v 1.5.2.4.2.4 2002/05/28 00:16:08 easysw Exp $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user