equal
deleted
inserted
replaced
24 */ |
24 */ |
25 |
25 |
26 package java.lang; |
26 package java.lang; |
27 |
27 |
28 import sun.misc.FloatingDecimal; |
28 import sun.misc.FloatingDecimal; |
29 import sun.misc.FpUtils; |
|
30 import sun.misc.FloatConsts; |
29 import sun.misc.FloatConsts; |
31 import sun.misc.DoubleConsts; |
30 import sun.misc.DoubleConsts; |
32 |
31 |
33 /** |
32 /** |
34 * The {@code Float} class wraps a value of primitive type |
33 * The {@code Float} class wraps a value of primitive type |
277 if (Math.abs(f) < FloatConsts.MIN_NORMAL |
276 if (Math.abs(f) < FloatConsts.MIN_NORMAL |
278 && f != 0.0f ) {// float subnormal |
277 && f != 0.0f ) {// float subnormal |
279 // Adjust exponent to create subnormal double, then |
278 // Adjust exponent to create subnormal double, then |
280 // replace subnormal double exponent with subnormal float |
279 // replace subnormal double exponent with subnormal float |
281 // exponent |
280 // exponent |
282 String s = Double.toHexString(FpUtils.scalb((double)f, |
281 String s = Double.toHexString(Math.scalb((double)f, |
283 /* -1022+126 */ |
282 /* -1022+126 */ |
284 DoubleConsts.MIN_EXPONENT- |
283 DoubleConsts.MIN_EXPONENT- |
285 FloatConsts.MIN_EXPONENT)); |
284 FloatConsts.MIN_EXPONENT)); |
286 return s.replaceFirst("p-1022$", "p-126"); |
285 return s.replaceFirst("p-1022$", "p-126"); |
287 } |
286 } |
288 else // double string will be the same as float string |
287 else // double string will be the same as float string |
289 return Double.toHexString(f); |
288 return Double.toHexString(f); |
290 } |
289 } |