APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.math

public final Class DoubleToDecimal

extends ToDecimal
Class Inheritance
Static Imports
java.lang.Double.*, java.lang.Long.*, .Math.multiplyHigh, jdk.internal.math.MathUtils.*

This class exposes a method to render a double as a string.

Field Summary

Modifier and TypeField and Description
private static final int
pack-priv static final long
pack-priv static final long
pack-priv static final long
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
H

pack-priv static final int
pack-priv static final int
public static final DoubleToDecimal
LATIN1

Use LATIN1 encoding to process the in-out byte[] str

private static final long
public static final int
pack-priv static final int
P

pack-priv static final int
pack-priv static final int
private static final long
public static final DoubleToDecimal
UTF16

Use UTF16 encoding to process the in-out byte[] str

pack-priv static final int
W

Inherited from jdk.internal.math.ToDecimal:
MASK_28MINUS_INFMINUS_ZERONANNON_SPECIALPLUS_INFPLUS_ZERO

Constructor Summary

AccessConstructor and Description
private
DoubleToDecimal(boolean latin1)

Method Summary

Modifier and TypeMethod and Description
private int
exponent(byte[] str, int index, int e)

private int
lowDigits(byte[] str, int index, int l)

public int
putDecimal(byte[]
the String byte array to append to
str
,
int
the index into str
index
,
double
the double whose rendering is into str.
v
)

Appends the rendering of the v to str.

private static long
rop(long g1, long g0, long cp)

public static void
split(double
the finite double to be split.
v
,
FormattedFPDecimal
the object that will carry f, e, and n.
fd
)

Splits the decimal d described in Double#toString(double) in integers f and e such that d = f 10e.

private int
toChars(byte[] str, int index, long f, int e, FormattedFPDecimal fd, boolean exact, boolean away)

private int
toChars1(byte[] str, int index, int h, int m, int l, int e)

private int
toChars2(byte[] str, int index, int h, int m, int l, int e)

private int
toChars3(byte[] str, int index, int h, int m, int l, int e)

private int
toDecimal(byte[] str, int index, double v, FormattedFPDecimal fd)

private int
toDecimal(byte[] str, int index, int q, long c, int dk, FormattedFPDecimal fd)

public static String

Returns:

a string representation of the argument.
toString
(double
the double to be converted.
v
)

Returns a string representation of the double argument.

Inherited from jdk.internal.math.ToDecimal:
lengthput8DigitsputCharputDigitputSpecialremoveTrailingZeroesspecialy

Field Detail

BQ_MASKback to summary
private static final int BQ_MASK
C_MAXback to summary
pack-priv static final long C_MAX
C_MINback to summary
pack-priv static final long C_MIN
C_TINYback to summary
pack-priv static final long C_TINY
E_MAXback to summary
pack-priv static final int E_MAX
E_MINback to summary
pack-priv static final int E_MIN
E_THR_Iback to summary
pack-priv static final int E_THR_I
E_THR_Zback to summary
pack-priv static final int E_THR_Z
Hback to summary
pack-priv static final int H
K_MAXback to summary
pack-priv static final int K_MAX
K_MINback to summary
pack-priv static final int K_MIN
LATIN1back to summary
public static final DoubleToDecimal LATIN1

Use LATIN1 encoding to process the in-out byte[] str

MASK_63back to summary
private static final long MASK_63
MAX_CHARSback to summary
public static final int MAX_CHARS
Pback to summary
pack-priv static final int P
Q_MAXback to summary
pack-priv static final int Q_MAX
Q_MINback to summary
pack-priv static final int Q_MIN
T_MASKback to summary
private static final long T_MASK
UTF16back to summary
public static final DoubleToDecimal UTF16

Use UTF16 encoding to process the in-out byte[] str

Wback to summary
pack-priv static final int W

Constructor Detail

DoubleToDecimalback to summary
private DoubleToDecimal(boolean latin1)

Method Detail

exponentback to summary
private int exponent(byte[] str, int index, int e)
lowDigitsback to summary
private int lowDigits(byte[] str, int index, int l)
putDecimalback to summary
public int putDecimal(byte[] str, int index, double v)

Appends the rendering of the v to str.

The outcome is the same as if v were first rendered and the resulting string were then

Parameters
str:byte[]

the String byte array to append to

index:int

the index into str

v:double

the double whose rendering is into str.

ropback to summary
private static long rop(long g1, long g0, long cp)
splitback to summary
public static void split(double v, FormattedFPDecimal fd)

Splits the decimal d described in Double#toString(double) in integers f and e such that d = f 10e.

Further, determines integer n such that n = 0 when f = 0, and 10n-1 ≤ f < 10n otherwise.

The argument v is assumed to be a positive finite value or positive zero. Further, fd must not be null.

Parameters
v:double

the finite double to be split.

fd:FormattedFPDecimal

the object that will carry f, e, and n.

toCharsback to summary
private int toChars(byte[] str, int index, long f, int e, FormattedFPDecimal fd, boolean exact, boolean away)
toChars1back to summary
private int toChars1(byte[] str, int index, int h, int m, int l, int e)
toChars2back to summary
private int toChars2(byte[] str, int index, int h, int m, int l, int e)
toChars3back to summary
private int toChars3(byte[] str, int index, int h, int m, int l, int e)
toDecimalback to summary
private int toDecimal(byte[] str, int index, double v, FormattedFPDecimal fd)
toDecimalback to summary
private int toDecimal(byte[] str, int index, int q, long c, int dk, FormattedFPDecimal fd)
toStringback to summary
public static String toString(double v)

Returns a string representation of the double argument. All characters mentioned below are ASCII characters.

Parameters
v:double

the double to be converted.

Returns:String

a string representation of the argument.

See Also
Double#toString(double)