home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / lang / Float.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  3.0 KB  |  138 lines

  1. package java.lang;
  2.  
  3. import sun.misc.FloatingDecimal;
  4. import sun.misc.FpUtils;
  5.  
  6. public final class Float extends Number implements Comparable<Float> {
  7.    public static final float POSITIVE_INFINITY = InfinityF;
  8.    public static final float NEGATIVE_INFINITY = -InfinityF;
  9.    public static final float NaN = NaNF;
  10.    public static final float MAX_VALUE = 3.4028235E38F;
  11.    public static final float MIN_NORMAL = 1.1754944E-38F;
  12.    public static final float MIN_VALUE = 1.4E-45F;
  13.    public static final int MAX_EXPONENT = 127;
  14.    public static final int MIN_EXPONENT = -126;
  15.    public static final int SIZE = 32;
  16.    public static final Class<Float> TYPE = Class.getPrimitiveClass("float");
  17.    private final float value;
  18.    private static final long serialVersionUID = -2671257302660747028L;
  19.  
  20.    public static String toString(float var0) {
  21.       return (new FloatingDecimal(var0)).toJavaFormatString();
  22.    }
  23.  
  24.    public static String toHexString(float var0) {
  25.       if (Math.abs(var0) < MIN_NORMAL && var0 != 0.0F) {
  26.          String var1 = Double.toHexString(FpUtils.scalb((double)var0, -896));
  27.          return var1.replaceFirst("p-1022$", "p-126");
  28.       } else {
  29.          return Double.toHexString((double)var0);
  30.       }
  31.    }
  32.  
  33.    public static Float valueOf(String var0) throws NumberFormatException {
  34.       return new Float(FloatingDecimal.readJavaFormatString(var0).floatValue());
  35.    }
  36.  
  37.    public static Float valueOf(float var0) {
  38.       return new Float(var0);
  39.    }
  40.  
  41.    public static float parseFloat(String var0) throws NumberFormatException {
  42.       return FloatingDecimal.readJavaFormatString(var0).floatValue();
  43.    }
  44.  
  45.    public static boolean isNaN(float var0) {
  46.       return var0 != var0;
  47.    }
  48.  
  49.    public static boolean isInfinite(float var0) {
  50.       return var0 == POSITIVE_INFINITY || var0 == NEGATIVE_INFINITY;
  51.    }
  52.  
  53.    public Float(float var1) {
  54.       this.value = var1;
  55.    }
  56.  
  57.    public Float(double var1) {
  58.       this.value = (float)var1;
  59.    }
  60.  
  61.    public Float(String var1) throws NumberFormatException {
  62.       this(valueOf(var1));
  63.    }
  64.  
  65.    public boolean isNaN() {
  66.       return isNaN(this.value);
  67.    }
  68.  
  69.    public boolean isInfinite() {
  70.       return isInfinite(this.value);
  71.    }
  72.  
  73.    public String toString() {
  74.       return String.valueOf(this.value);
  75.    }
  76.  
  77.    public byte byteValue() {
  78.       return (byte)((int)this.value);
  79.    }
  80.  
  81.    public short shortValue() {
  82.       return (short)((int)this.value);
  83.    }
  84.  
  85.    public int intValue() {
  86.       return (int)this.value;
  87.    }
  88.  
  89.    public long longValue() {
  90.       return (long)this.value;
  91.    }
  92.  
  93.    public float floatValue() {
  94.       return this.value;
  95.    }
  96.  
  97.    public double doubleValue() {
  98.       return (double)this.value;
  99.    }
  100.  
  101.    public int hashCode() {
  102.       return floatToIntBits(this.value);
  103.    }
  104.  
  105.    public boolean equals(Object var1) {
  106.       return var1 instanceof Float && floatToIntBits(((Float)var1).value) == floatToIntBits(this.value);
  107.    }
  108.  
  109.    public static int floatToIntBits(float var0) {
  110.       int var1 = floatToRawIntBits(var0);
  111.       if ((var1 & 2139095040) == 2139095040 && (var1 & 8388607) != 0) {
  112.          var1 = 2143289344;
  113.       }
  114.  
  115.       return var1;
  116.    }
  117.  
  118.    public static native int floatToRawIntBits(float var0);
  119.  
  120.    public static native float intBitsToFloat(int var0);
  121.  
  122.    public int compareTo(Float var1) {
  123.       return compare(this.value, var1.value);
  124.    }
  125.  
  126.    public static int compare(float var0, float var1) {
  127.       if (var0 < var1) {
  128.          return -1;
  129.       } else if (var0 > var1) {
  130.          return 1;
  131.       } else {
  132.          int var2 = floatToIntBits(var0);
  133.          int var3 = floatToIntBits(var1);
  134.          return var2 == var3 ? 0 : (var2 < var3 ? -1 : 1);
  135.       }
  136.    }
  137. }
  138.