mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Valuator.cxx
int Fl_Valuator::format(char* buffer) {
  double v = value();
  // MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT
  if (!A || !B) return snprintf(buffer, 128, "%g", v);

  // Figure out how many digits are required to correctly format the
  // value.
  int i, c = 0;
  char temp[32];
  // output a number with many digits after the decimal point. This
  // seems to be needed to get high precission
  snprintf(temp, sizeof(temp), "%.12f", A/B);
  // strip all trailing 0's
  for (i=strlen(temp)-1; i>0; i--) {
    if (temp[i]!='0') break;
  }
  // count digits until we find the decimal point (or comma or whatever
  // letter is set in the current locale)
  for (; i>0; i--, c++) {
    if (!isdigit(temp[i])) break;
  }

  // MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT
  return snprintf(buffer, 128, "%.*f", c, v);
}
/**
  Uses internal rules to format the fields numerical value into
  the character array pointed to by the passed parameter.</P>
  
  <P>The actual format used depends on the current step value. If
  the step value has been set to zero then a %g format is used.
  If the step value is non-zero, then a %.*f format is used,
  where the precision is calculated to show sufficient digits
  for the current step value. An integer step value, such as 1
  or 1.0, gives a precision of 0, so the formatted value will
  appear as an integer.</P>
  
  <P>This method is used by the Fl_Value_... group of widgets to 
  format the current value into a text string. 
  The return value is the length of the formatted text.
  The formatted value is written into in <i>buffer</i>. 
  <i>buffer</i> should have space for at least 128 bytes.</P>
  
  <P>You may override this function to create your own text formatting.
*/
Uses internal rules to format the fields numerical value into
the character array pointed to by the passed parameter.

The actual format used depends on the current step value. If
the step value has been set to zero then a %g format is used.
If the step value is non-zero, then a %.*f format is used,
where the precision is calculated to show sufficient digits
for the current step value. An integer step value, such as 1
or 1.0, gives a precision of 0, so the formatted value will
appear as an integer.

This method is used by the Fl_Value_... group of widgets to
format the current value into a text string.
The return value is the length of the formatted text.
The formatted value is written into in buffer.
buffer should have space for at least 128 bytes.

You may override this function to create your own text formatting.
Uses internal rules to format the fields numerical value into the character array pointed to by the passed parameter . The actual format used depends on the current step value . If the step value has been set to zero then a %g format is used . If the step value is non - zero then a % . * f format is used where the precision is calculated to show sufficient digits for the current step value . An integer step value such as 1 or 1 . 0 gives a precision of 0 so the formatted value will appear as an integer . This method is used by the Fl_Value_ ... group of widgets to format the current value into a text string . The return value is the length of the formatted text . The formatted value is written into in buffer . buffer should have space for at least 128 bytes . You may override this function to create your own text formatting .
int Fl_Valuator::format(char* buffer) {
  double v = value();
  if (!A || !B) return snprintf(buffer, 128, "%g", v);
  int i, c = 0;
  char temp[32];
  snprintf(temp, sizeof(temp), "%.12f", A/B);
  for (i=strlen(temp)-1; i>0; i--) {
    if (temp[i]!='0') break;
  }
  for (; i>0; i--, c++) {
    if (!isdigit(temp[i])) break;
  }
  return snprintf(buffer, 128, "%.*f", c, v);
}
int Fl_Valuator :: format ( char * buffer ) { double v = value ( ) ; if ( ! A || ! B ) return snprintf ( buffer , 128 , " " , v ) ; int i , c = 0 ; char temp [ 32 ] ; snprintf ( temp , sizeof ( temp ) , " " , A / B ) ; for ( i = strlen ( temp ) - 1 ; i > 0 ; i -- ) { if ( temp [ i ] != ' ' ) break ; } for ( ; i > 0 ; i -- , c ++ ) { if ( ! isdigit ( temp [ i ] ) ) break ; } return snprintf ( buffer , 128 , " " , c , v ) ; }
Uses internal rules to format the fields numerical value into
the character array pointed to by the passed parameter.</P>
Uses internal rules to format the fields numerical value into the character array pointed to by the passed parameter . < / P >
// MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT // Figure out how many digits are required to correctly format the // value. // output a number with many digits after the decimal point. This // seems to be needed to get high precission // strip all trailing 0's // count digits until we find the decimal point (or comma or whatever // letter is set in the current locale) // MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT