From 465d6f914af6cf258bad5c70498eaadb2262c732 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 28 May 2002 00:16:08 +0000 Subject: 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 --- src/Fl_Valuator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Fl_Valuator.cxx b/src/Fl_Valuator.cxx index 081ba056e..f2b365505 100644 --- a/src/Fl_Valuator.cxx +++ b/src/Fl_Valuator.cxx @@ -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 $". // -- cgit v1.2.3