public final class DoubleConversion extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
bignumDtoa(double v,
DtoaMode mode,
int digits,
DtoaBuffer buffer)
Converts a double number to a string representation using the
BignumDtoa algorithm
and the specified conversion mode and number of digits. |
static boolean |
fastDtoaCounted(double v,
int precision,
DtoaBuffer buffer)
Converts a double number to a string representation with the given number of digits using the
FastDtoa algorithm. |
static boolean |
fastDtoaShortest(double v,
DtoaBuffer buffer)
Converts a double number to its shortest string representation using the
FastDtoa
algorithm. |
static boolean |
fixedDtoa(double v,
int digits,
DtoaBuffer buffer)
Converts a double number to a string representation with a fixed number of digits after the
decimal point using the
FixedDtoa algorithm. |
static String |
toExponential(double value,
int requestedDigits)
Computes a representation in exponential format with requestedDigits after the decimal point.
|
static String |
toExponential(double value,
int requestedDigits,
boolean uniqueZero)
Computes a representation in exponential format with requestedDigits after the decimal point.
|
static String |
toFixed(double value,
int requestedDigits)
Converts a double number to a string representation with a fixed number of digits after the
decimal point.
|
static String |
toPrecision(double value,
int precision)
Converts a double number to a string representation with a fixed number of digits.
|
static String |
toShortest(double value)
Converts a double number to its shortest string representation.
|
public static String toShortest(double value)
value - number to convertpublic static String toFixed(double value, int requestedDigits)
value - number to convert.requestedDigits - number of digits after decimal pointpublic static String toPrecision(double value, int precision)
value - number to convertprecision - number of digits to createpublic static void bignumDtoa(double v,
DtoaMode mode,
int digits,
DtoaBuffer buffer)
BignumDtoa algorithm
and the specified conversion mode and number of digits.v - number to convertmode - conversion modedigits - number of digitsbuffer - buffer to usepublic static boolean fastDtoaShortest(double v,
DtoaBuffer buffer)
FastDtoa
algorithm.v - number to convertbuffer - buffer to usepublic static boolean fastDtoaCounted(double v,
int precision,
DtoaBuffer buffer)
FastDtoa algorithm.v - number to convertprecision - number of digits to generatebuffer - buffer to usepublic static boolean fixedDtoa(double v,
int digits,
DtoaBuffer buffer)
FixedDtoa algorithm.v - number to convert.digits - number of digits after the decimal pointbuffer - buffer to usepublic static String toExponential(double value, int requestedDigits)
value - number to convertrequestedDigits - number of digits after the decimal pointpublic static String toExponential(double value, int requestedDigits, boolean uniqueZero)
value - number to convertrequestedDigits - number of digits after the decimal pointuniqueZero - "-0.0" is converted to "0.0".