public enum Form { SCIENTIFIC, COMPATIBLE, DECIMAL_FLOAT, GENERAL }; static final long signMask = 0x8000000000000000L;
static final long expMask = 0x7ff0000000000000L;
static final long highbyte = 0xff00000000000000L;
static final long highbit = 0x8000000000000000L;
return (b5p[p] = bigq.mult( bigr ) );
assert lbits != 0L : lbits;
lbits >>>= lowOrderZeros;
ulp( double dval, boolean subtracting ){ } else if ( binexp == 0 ){ if ( subtracting ) ulpval = - ulpval;
if ( binexp == 0L || binexp == expMask ){ for ( i = 0; insignificant >= 10L; i++ )
long residue = lvalue % pow10;
if ( residue >= (pow10>>1) ){ assert lvalue > 0L : lvalue;
int ivalue = (int)lvalue;
digits[digitno--] = (char)(c+'0');
digits[digitno] = (char)(c+'0');
digits[digitno--] = (char)(c+'0');
digits[digitno] = (char)(c+'0');
result = new char[ ndigits ];
System.arraycopy( digits, digitno, result, 0, ndigits );
while ( q == '9' && i > 0 ){ if (length >= nDigits || length < 0)
for (int i = 0; i < length; i++)
char [] result = new char[nDigits];
for (int i = 0; i < result.length; i++) result[i] = '0';
if (length >= nDigits || length < 0) { while ( q == '9' && i > 0 ){ result[i] = (char)(q + 1);
nSignificantBits = expShift + binExp +1;
dtoa( binExp, fractBits, nSignificantBits );
dtoa( int binExp, long fractBits, int nSignificantBits )
nTinyBits = Math.max( 0, nFractBits - binExp - 1 );
if ( binExp > nSignificantBits ){ halfULP = 1L << ( binExp-nSignificantBits-1);
decExp = (int)Math.floor(
(d2-1.5D)*0.289529654D + 0.176091259 + (double)binExp * 0.301029995663981 );
B5 = Math.max( 0, -decExp );
B2 = B5 + nTinyBits + binExp;
S5 = Math.max( 0, decExp );
M2 = B2 - nSignificantBits;
int common2factor = Math.min( B2, S2 );
char digits[] = this.digits = new char[18];
if ( Bbits < 64 && tenSbits < 64){ if ( Bbits < 32 && tenSbits < 32){ int b = ((int)fractBits * small5pow[B5] ) << B2;
if ( (q == 0) && ! high ){ digits[ndigit++] = (char)('0' + q); while( ! low && ! high ){ digits[ndigit++] = (char)('0' + q); lowDigitDifference = (b<<1) - tens;
long b = (fractBits * long5pow[B5] ) << B2;
if ( (q == 0) && ! high ){ digits[ndigit++] = (char)('0' + q); while( ! low && ! high ){ digits[ndigit++] = (char)('0' + q); lowDigitDifference = (b<<1) - tens;
tenSval = Sval.mult( 10 );
low = (Bval.cmp( Mval ) < 0);
high = (Bval.add( Mval ).cmp( tenSval ) > 0 );
if ( (q == 0) && ! high ){ digits[ndigit++] = (char)('0' + q); while( ! low && ! high ){ low = (Bval.cmp( Mval ) < 0);
high = (Bval.add( Mval ).cmp( tenSval ) > 0 );
digits[ndigit++] = (char)('0' + q); lowDigitDifference = Bval.cmp(tenSval);
if ( lowDigitDifference == 0L ){ } else if ( lowDigitDifference > 0 ){ return new String(result, 0, i);
System.arraycopy(digits, 0, result, i, charLength);
charLength = exp-charLength;
for (int nz = 0; nz < charLength; nz++)
System.arraycopy(digits, charLength, result, i, t);
System.arraycopy(digits, charLength, result, i, t);
for (int nz = 0; nz < t; nz++)
result[i++] = (char)(e+'0');
result[i++] = (char)(e/10 +'0');
result[i++] = (char)(e%10 + '0');
result[i++] = (char)(e/100+'0');
result[i++] = (char)(e/10+'0');
result[i++] = (char)(e%10 + '0');
boolean isNegative = false;
boolean signSeen = false;
switch ( c = in.charAt( i ) ){ if(c == 'N' || c == 'I') { boolean potentialNaN = false;
char targetChars[] = null;
while(i < l && j < targetChars.length) { if(in.charAt(i) == targetChars[j]) { if( (j == targetChars.length) && (i == l) ) { if (ch == 'x' || ch == 'X' )
char[] digits = new char[ l ];
switch ( c = in.charAt( i ) ){ while ( nTrailZero > 0 ){ decExp = decPt - nLeadZero;
decExp = nDigits+nTrailZero;
if ( (i < l) && (((c = in.charAt(i) )=='e') || (c == 'E') ) ){ boolean expOverflow = false;
if ( expVal >= reallyBig ){ switch ( c = in.charAt(i++) ){ expVal = expVal*10 + ( (int)c - (int)'0' );
if ( expOverflow || ( expVal > expLimit ) ){ decExp = expSign*expLimit;
decExp = decExp + expSign*expVal;
int iValue = (int)digits[0]-(int)'0';
for ( int i=1; i < iDigits; i++ ){ iValue = iValue*10 + (int)digits[i]-(int)'0';
for ( int i=iDigits; i < kDigits; i++ ){ lValue = lValue*10L + (long)((int)digits[i]-(int)'0');
if (exp == 0 || dValue == 0.0)
for( j = 0; exp > 1; j++, exp>>=1 ){ for( j = 0; exp > 1; j++, exp>>=1 ){ int common2 = Math.min( B2, Math.min( D2, Ulp2 ) );
if ( (cmpResult = bigB.cmp( bigD ) ) > 0 ){ } else if ( cmpResult < 0 ){ if ( (cmpResult = diff.cmp( halfUlp ) ) < 0 ){ } else if ( cmpResult == 0 ){ dValue += 0.5*ulp( dValue, overvalue );
dValue += ulp( dValue, overvalue );
iValue = (int)digits[0]-(int)'0';
for ( int i=1; i < kDigits; i++ ){ iValue = iValue*10 + (int)digits[i]-(int)'0';
if (exp == 0 || fValue == 0.0f)
long lValue = (long)iValue;
for ( int i=kDigits; i < nDigits; i++ ){ lValue = lValue*10L + (long)((int)digits[i]-(int)'0');
double dValue = (double)lValue;
1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5,
1.0e6, 1.0e7, 1.0e8, 1.0e9, 1.0e10,
1.0e11, 1.0e12, 1.0e13, 1.0e14, 1.0e15,
1.0e16, 1.0e17, 1.0e18, 1.0e19, 1.0e20,
1.0e1f, 1.0e2f, 1.0e3f, 1.0e4f, 1.0e5f,
1.0e6f, 1.0e7f, 1.0e8f, 1.0e9f, 1.0e10f
private static final double big10pow[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
1e-16, 1e-32, 1e-64, 1e-128, 1e-256 };
5*5*5*5*5*5*5*5*5*5*5*5*5
private static final long long5pow[] = { 5L*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
5L*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5,
private static final int n5bits[] = { private static final char infinity[] = { 'I', 'n', 'f', 'i', 'n', 'i', 't', 'y' }; private static final char notANumber[] = { 'N', 'a', 'N' }; private static final char zero[] = { '0', '0', '0', '0', '0', '0', '0', '0' }; "([-+])?0[xX](((\\p{XDigit}+)\\.?)|((\\p{XDigit}*)\\.(\\p{XDigit}+)))[pP]([-+])?(\\p{Digit}+)[fFdD]?" double sign = (( group1 == null ) || group1.equals("+"))? 1.0 : -1.0; String significandString =null;
if( (group4 = m.group(4)) != null) { leftDigits = significandString.length();
rightDigits = group7.length();
((group6 == null)?"":group6) +
signifLength = significandString.length();
exponentAdjust = 4*(leftDigits - 1);
exponentAdjust = -4*( rightDigits - signifLength + 1);
boolean positiveExponent = ( group8 == null ) || group8.equals("+"); long unsignedRawExponent;
(positiveExponent ? 1L : -1L) *
long exponent = rawExponent + exponentAdjust ;
significand |= leadingDigit << 52;
else if (leadingDigit <= 3) { significand |= leadingDigit << 51;
else if (leadingDigit <= 7) { significand |= leadingDigit << 50;
else if (leadingDigit <= 15) { significand |= leadingDigit << 49;
i < signifLength && nextShift >= 0;
significand |= (currentDigit << nextShift);
if ( i < signifLength ) { significand |= ((currentDigit & 0xEL) >> 1);
round = (currentDigit & 0x1L) != 0L;
significand |= ((currentDigit & 0xCL) >> 2);
round = (currentDigit &0x2L) != 0L;
sticky = (currentDigit & 0x1L) != 0;
significand |= ((currentDigit & 0x8L)>>3);
round = (currentDigit &0x4L) != 0L;
sticky = (currentDigit & 0x3L) != 0;
round = ((currentDigit & 0x8L) != 0);
sticky = (currentDigit & 0x7L) != 0;
while(i < signifLength && !sticky) { sticky = sticky || (currentDigit != 0);
significand = (( ((long)exponent +
sticky = sticky || round;
assert bitsDiscarded >= 1 && bitsDiscarded <= 53;
round = (significand & (1L << (bitsDiscarded -1))) != 0L;
long mask = ~((~0L) << (bitsDiscarded -1));
sticky = sticky || ((significand & mask) != 0L ) ;
significand = significand >> bitsDiscarded;
boolean incremented = false;
boolean leastZero = ((significand & 1L) == 0L);
if( ( leastZero && round && sticky ) ||
((!leastZero) && round )) { if ((significand & 0xfffffffL) == 0x0L) { Return
s with any leading zeros removed.
Extract a hexadecimal digit from position
position
of string
s.
if (value <= -1 || value >= 16) { throw new AssertionError("Unxpected failure of digit converstion of " +