src/share/classes/sun/misc/FormattedFloatingDecimal.java

Print this page

        

*** 28,38 **** import sun.misc.FpUtils; import sun.misc.DoubleConsts; import sun.misc.FloatConsts; import java.util.regex.*; ! public strictfp class FormattedFloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; // value set at construction, then immutable int decExponentRounded; char digits[]; --- 28,38 ---- import sun.misc.FpUtils; import sun.misc.DoubleConsts; import sun.misc.FloatConsts; import java.util.regex.*; ! public class FormattedFloatingDecimal{ boolean isExceptional; boolean isNegative; int decExponent; // value set at construction, then immutable int decExponentRounded; char digits[];
*** 245,256 **** * Compute a number that is the ULP of the given value, * for purposes of addition/subtraction. Generally easy. * More difficult if subtracting and the argument * is a normalized a power of 2, as the ULP changes at these points. */ ! private static double ! ulp( double dval, boolean subtracting ){ long lbits = Double.doubleToLongBits( dval ) & ~signMask; int binexp = (int)(lbits >>> expShift); double ulpval; if ( subtracting && ( binexp >= expShift ) && ((lbits&fractMask) == 0L) ){ // for subtraction from normalized, powers of 2, --- 245,255 ---- * Compute a number that is the ULP of the given value, * for purposes of addition/subtraction. Generally easy. * More difficult if subtracting and the argument * is a normalized a power of 2, as the ULP changes at these points. */ ! private static double ulp( double dval, boolean subtracting ){ long lbits = Double.doubleToLongBits( dval ) & ~signMask; int binexp = (int)(lbits >>> expShift); double ulpval; if ( subtracting && ( binexp >= expShift ) && ((lbits&fractMask) == 0L) ){ // for subtraction from normalized, powers of 2,
*** 1155,1166 **** * AS A SIDE EFFECT, SET roundDir TO INDICATE PREFERRED * ROUNDING DIRECTION in case the result is really destined * for a single-precision float. */ ! public double ! doubleValue(){ int kDigits = Math.min( nDigits, maxDecimalDigits+1 ); long lValue; double dValue; double rValue, tValue; --- 1154,1164 ---- * AS A SIDE EFFECT, SET roundDir TO INDICATE PREFERRED * ROUNDING DIRECTION in case the result is really destined * for a single-precision float. */ ! public strictfp double doubleValue(){ int kDigits = Math.min( nDigits, maxDecimalDigits+1 ); long lValue; double dValue; double rValue, tValue;
*** 1515,1526 **** * to double has one rounding error, and the conversion of that double * to a float has another rounding error, IN THE WRONG DIRECTION, * ( because of the preference to a zero low-order bit ). */ ! public float ! floatValue(){ int kDigits = Math.min( nDigits, singleMaxDecimalDigits+1 ); int iValue; float fValue; // First, check for NaN and Infinity values --- 1513,1523 ---- * to double has one rounding error, and the conversion of that double * to a float has another rounding error, IN THE WRONG DIRECTION, * ( because of the preference to a zero low-order bit ). */ ! public strictfp float floatValue(){ int kDigits = Math.min( nDigits, singleMaxDecimalDigits+1 ); int iValue; float fValue; // First, check for NaN and Infinity values