/[classpath]/classpath/java/lang/Double.java
ViewVC logotype

Diff of /classpath/java/lang/Double.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by cbj, Thu Nov 15 02:23:35 2001 UTC revision 1.27 by ericb, Tue Jan 15 16:38:55 2002 UTC
# Line 1  Line 1 
1  /* Double.java -- object wrapper for double primitive  /* Double.java -- object wrapper for double primitive
2     Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 44  import gnu.classpath.Configuration; Line 44  import gnu.classpath.Configuration;
44   *   *
45   * @author Paul Fisher   * @author Paul Fisher
46   * @author Andrew Haley <aph@cygnus.com>   * @author Andrew Haley <aph@cygnus.com>
47   * @since JDK 1.0   * @author Eric Blake <ebb9@email.byu.edu>
48     * @since 1.0
49   */   */
50  public final class Double extends Number implements Comparable  public final class Double extends Number implements Comparable
51  {  {
# Line 163  public final class Double extends Number Line 164  public final class Double extends Number
164      if (!(obj instanceof Double))      if (!(obj instanceof Double))
165        return false;        return false;
166    
167      Double d = (Double) obj;      double d = ((Double) obj).value;
168    
169      return doubleToLongBits (value) == doubleToLongBits (d.doubleValue ());      // common case first, then check NaN and 0
170        if (value == d)
171          return (value != 0) || (1 / value == 1 / d);
172        return isNaN(value) && isNaN(d);
173    }    }
174    
175    /**    /**
# Line 336  public final class Double extends Number Line 340  public final class Double extends Number
340        return isNaN (y) ? 0 : 1;        return isNaN (y) ? 0 : 1;
341      if (isNaN (y))      if (isNaN (y))
342        return -1;        return -1;
343      if (x == 0.0d && y == -0.0d)      // recall that 0.0 == -0.0, so we convert to infinites and try again
344        return 1;      if (x == 0 && y == 0)
345      if (x == -0.0d && y == 0.0d)        return (int) (1 / x - 1 / y);
       return -1;  
346      if (x == y)      if (x == y)
347        return 0;        return 0;
348    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26