gnu.math

Class ExponentialFormat


public class ExponentialFormat
extends java.text.Format

Format a real number using a floating-point format. However, if `general' is true, and the number "fits", use a fixed-point format (like printf %g). Used for Common Lisp specs ~E and ~G; also C-style %e and %g.

Field Summary

int
expDigits
Number of digits to show in the exponent.
char
exponentChar
boolean
exponentShowSign
Display sign of exponent even when it is non-negative.
int
fracDigits
Number of fractional digits to show.
boolean
general
int
intDigits
Number of digits to show in the integer part of the result.
char
overflowChar
char
padChar
boolean
showPlus
True if '+' should be printed for non-negative number.
int
width

Method Summary

StringBuffer
format(Object num, StringBuffer sbuf, FieldPosition fpos)
StringBuffer
format(double value, StringBuffer sbuf, FieldPosition fpos)
StringBuffer
format(float value, StringBuffer sbuf, FieldPosition fpos)
StringBuffer
format(long num, StringBuffer sbuf, FieldPosition fpos)
java.lang.Number
parse(String text, java.text.ParsePosition status)
Object
parseObject(String text, java.text.ParsePosition status)

Field Details

expDigits

public int expDigits
Number of digits to show in the exponent. Zero means unspecified - show as many as needed.

exponentChar

public char exponentChar

exponentShowSign

public boolean exponentShowSign
Display sign of exponent even when it is non-negative.

fracDigits

public int fracDigits
Number of fractional digits to show. This is `d' in the CommonLisp spec.

general

public boolean general

intDigits

public int intDigits
Number of digits to show in the integer part of the result. If positive, The number of digits before the decimal point. If negative, the -intDigits zeros are emitted after the decimal point. This is `k' in the CommonLisp spec.

overflowChar

public char overflowChar

padChar

public char padChar

showPlus

public boolean showPlus
True if '+' should be printed for non-negative number.

width

public int width

Method Details

format

public StringBuffer format(Object num,
                           StringBuffer sbuf,
                           FieldPosition fpos)

format

public StringBuffer format(double value,
                           StringBuffer sbuf,
                           FieldPosition fpos)

format

public StringBuffer format(float value,
                           StringBuffer sbuf,
                           FieldPosition fpos)

format

public StringBuffer format(long num,
                           StringBuffer sbuf,
                           FieldPosition fpos)

parse

public java.lang.Number parse(String text,
                              java.text.ParsePosition status)

parseObject

public Object parseObject(String text,
                          java.text.ParsePosition status)