Public Member Functions | |
String | format (double x, int width, int prec, boolean fsgn) |
Formats a double floating point number in fixed point notation. | |
String | format (Object v, int width, int prec, boolean fsgn) |
Formats a number in fixed point notation. |
String gridripper::util::FixedPointFormatter::format | ( | double | x, | |
int | width, | |||
int | prec, | |||
boolean | fsgn | |||
) | [inline] |
Formats a double floating point number in fixed point notation.
The number is right adjusted on the field boundary. Calling s = format(x, 10, 3, false) is equivalent to the C function call sprintf(s, "%10.3f", x), format(x, 10, 3, true) is equivalent to sprintf(s, "%+10.3f", x).
x | the number | |
width | the width of the field | |
prec | precision, number of fraction digits | |
fsgn | force writing the sign even if the number is positive |
String gridripper::util::FixedPointFormatter::format | ( | Object | v, | |
int | width, | |||
int | prec, | |||
boolean | fsgn | |||
) | [inline] |
Formats a number in fixed point notation.
The number is right adjusted on the field boundary. Calling s = format(x, 10, 3, false) is equivalent to the C function call sprintf(s, "%10.3f", x), format(x, 10, 3, true) is equivalent to sprintf(s, "%+10.3f", x).
v | the number (a Double, Float, Integer, Short, Long or Byte) | |
width | the width of the field | |
prec | precision, number of fraction digits | |
fsgn | force writing the sign even if the number is positive |