gnu.math

Class ExponentialFormat

public class ExponentialFormat extends 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
intexpDigits
Number of digits to show in the exponent.
charexponentChar
booleanexponentShowSign
Display sign of exponent even when it is non-negative.
intfracDigits
Number of fractional digits to show.
booleangeneral
intintDigits
Number of digits to show in the integer part of the result.
charoverflowChar
charpadChar
booleanshowPlus
True if '+' should be printed for non-negative number.
intwidth
Method Summary
StringBufferformat(float value, StringBuffer sbuf, FieldPosition fpos)
StringBufferformat(double value, StringBuffer sbuf, FieldPosition fpos)
StringBufferformat(long num, StringBuffer sbuf, FieldPosition fpos)
StringBufferformat(Object num, StringBuffer sbuf, FieldPosition fpos)
Numberparse(String text, ParsePosition status)
ObjectparseObject(String text, ParsePosition status)

Field Detail

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 Detail

format

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

format

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

format

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

format

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

parse

public Number parse(String text, ParsePosition status)

parseObject

public Object parseObject(String text, ParsePosition status)