1.1 --- a/emul/src/main/java/java/lang/Float.java Sat Sep 29 10:56:23 2012 +0200
1.2 +++ b/emul/src/main/java/java/lang/Float.java Sun Sep 30 18:29:37 2012 -0700
1.3 @@ -25,11 +25,6 @@
1.4
1.5 package java.lang;
1.6
1.7 -import sun.misc.FloatingDecimal;
1.8 -import sun.misc.FpUtils;
1.9 -import sun.misc.FloatConsts;
1.10 -import sun.misc.DoubleConsts;
1.11 -
1.12 /**
1.13 * The {@code Float} class wraps a value of primitive type
1.14 * {@code float} in an object. An object of type
1.15 @@ -196,7 +191,8 @@
1.16 * @return a string representation of the argument.
1.17 */
1.18 public static String toString(float f) {
1.19 - return new FloatingDecimal(f).toJavaFormatString();
1.20 + throw new UnsupportedOperationException();
1.21 +// return new FloatingDecimal(f).toJavaFormatString();
1.22 }
1.23
1.24 /**
1.25 @@ -274,19 +270,20 @@
1.26 * @author Joseph D. Darcy
1.27 */
1.28 public static String toHexString(float f) {
1.29 - if (Math.abs(f) < FloatConsts.MIN_NORMAL
1.30 - && f != 0.0f ) {// float subnormal
1.31 - // Adjust exponent to create subnormal double, then
1.32 - // replace subnormal double exponent with subnormal float
1.33 - // exponent
1.34 - String s = Double.toHexString(FpUtils.scalb((double)f,
1.35 - /* -1022+126 */
1.36 - DoubleConsts.MIN_EXPONENT-
1.37 - FloatConsts.MIN_EXPONENT));
1.38 - return s.replaceFirst("p-1022$", "p-126");
1.39 - }
1.40 - else // double string will be the same as float string
1.41 - return Double.toHexString(f);
1.42 + throw new UnsupportedOperationException();
1.43 +// if (Math.abs(f) < FloatConsts.MIN_NORMAL
1.44 +// && f != 0.0f ) {// float subnormal
1.45 +// // Adjust exponent to create subnormal double, then
1.46 +// // replace subnormal double exponent with subnormal float
1.47 +// // exponent
1.48 +// String s = Double.toHexString(FpUtils.scalb((double)f,
1.49 +// /* -1022+126 */
1.50 +// DoubleConsts.MIN_EXPONENT-
1.51 +// FloatConsts.MIN_EXPONENT));
1.52 +// return s.replaceFirst("p-1022$", "p-126");
1.53 +// }
1.54 +// else // double string will be the same as float string
1.55 +// return Double.toHexString(f);
1.56 }
1.57
1.58 /**
1.59 @@ -414,7 +411,8 @@
1.60 * parsable number.
1.61 */
1.62 public static Float valueOf(String s) throws NumberFormatException {
1.63 - return new Float(FloatingDecimal.readJavaFormatString(s).floatValue());
1.64 + throw new UnsupportedOperationException();
1.65 +// return new Float(FloatingDecimal.readJavaFormatString(s).floatValue());
1.66 }
1.67
1.68 /**
1.69 @@ -449,7 +447,8 @@
1.70 * @since 1.2
1.71 */
1.72 public static float parseFloat(String s) throws NumberFormatException {
1.73 - return FloatingDecimal.readJavaFormatString(s).floatValue();
1.74 + throw new UnsupportedOperationException();
1.75 +// return FloatingDecimal.readJavaFormatString(s).floatValue();
1.76 }
1.77
1.78 /**
1.79 @@ -710,14 +709,15 @@
1.80 * @return the bits that represent the floating-point number.
1.81 */
1.82 public static int floatToIntBits(float value) {
1.83 - int result = floatToRawIntBits(value);
1.84 - // Check for NaN based on values of bit fields, maximum
1.85 - // exponent and nonzero significand.
1.86 - if ( ((result & FloatConsts.EXP_BIT_MASK) ==
1.87 - FloatConsts.EXP_BIT_MASK) &&
1.88 - (result & FloatConsts.SIGNIF_BIT_MASK) != 0)
1.89 - result = 0x7fc00000;
1.90 - return result;
1.91 + throw new UnsupportedOperationException();
1.92 +// int result = floatToRawIntBits(value);
1.93 +// // Check for NaN based on values of bit fields, maximum
1.94 +// // exponent and nonzero significand.
1.95 +// if ( ((result & FloatConsts.EXP_BIT_MASK) ==
1.96 +// FloatConsts.EXP_BIT_MASK) &&
1.97 +// (result & FloatConsts.SIGNIF_BIT_MASK) != 0)
1.98 +// result = 0x7fc00000;
1.99 +// return result;
1.100 }
1.101
1.102 /**