home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / lang / Double.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  2.0 KB  |  72 lines

  1. package java.lang;
  2.  
  3. public final class Double extends Number {
  4.    public static final double POSITIVE_INFINITY = (double)Float.POSITIVE_INFINITY;
  5.    public static final double NEGATIVE_INFINITY = (double)Float.NEGATIVE_INFINITY;
  6.    public static final double NaN = NaN;
  7.    public static final double MAX_VALUE = 1.7976931348623157E308;
  8.    public static final double MIN_VALUE = MIN_NORMAL;
  9.    private double value;
  10.  
  11.    public static native String toString(double var0);
  12.  
  13.    public static native Double valueOf(String var0) throws NumberFormatException;
  14.  
  15.    public static boolean isNaN(double v) {
  16.       return v != v;
  17.    }
  18.  
  19.    public static boolean isInfinite(double v) {
  20.       return v == POSITIVE_INFINITY || v == NEGATIVE_INFINITY;
  21.    }
  22.  
  23.    public Double(double value) {
  24.       this.value = value;
  25.    }
  26.  
  27.    public Double(String s) throws NumberFormatException {
  28.       this(valueOf(s));
  29.    }
  30.  
  31.    public boolean isNaN() {
  32.       return isNaN(this.value);
  33.    }
  34.  
  35.    public boolean isInfinite() {
  36.       return isInfinite(this.value);
  37.    }
  38.  
  39.    public String toString() {
  40.       return String.valueOf(this.value);
  41.    }
  42.  
  43.    public int intValue() {
  44.       return (int)this.value;
  45.    }
  46.  
  47.    public long longValue() {
  48.       return (long)this.value;
  49.    }
  50.  
  51.    public float floatValue() {
  52.       return (float)this.value;
  53.    }
  54.  
  55.    public double doubleValue() {
  56.       return this.value;
  57.    }
  58.  
  59.    public int hashCode() {
  60.       long bits = doubleToLongBits(this.value);
  61.       return (int)(bits ^ bits >> 32);
  62.    }
  63.  
  64.    public boolean equals(Object obj) {
  65.       return obj != null && obj instanceof Double && doubleToLongBits(((Double)obj).value) == doubleToLongBits(this.value);
  66.    }
  67.  
  68.    public static native long doubleToLongBits(double var0);
  69.  
  70.    public static native double longBitsToDouble(long var0);
  71. }
  72.