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

Diff of /classpath/java/lang/Float.java

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

revision 1.21 by mark, Sun Nov 11 16:07:09 2001 UTC revision 1.22 by ericb, Tue Jan 15 16:38:55 2002 UTC
# Line 1  Line 1 
1  /* java.lang.Float  /* java.lang.Float
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 Float extends Number implements Comparable  public final class Float extends Number implements Comparable
51  {  {
# Line 232  public final class Float extends Number Line 233  public final class Float extends Number
233      if (!(obj instanceof Float))      if (!(obj instanceof Float))
234        return false;        return false;
235    
236      Float f = (Float) obj;      float f = ((Float) obj).value;
237    
238      return floatToIntBits (value) == floatToIntBits (f.floatValue ());      // common case first, then check NaN and 0
239        if (value == f)
240          return (value != 0) || (1 / value == 1 / f);
241        return isNaN(value) && isNaN(f);
242    }    }
243    
244    /**    /**
# Line 484  public final class Float extends Number Line 488  public final class Float extends Number
488        return isNaN (y) ? 0 : 1;        return isNaN (y) ? 0 : 1;
489      if (isNaN (y))      if (isNaN (y))
490        return -1;        return -1;
491      if (x == 0.0 && y == -0.0)      // recall that 0.0 == -0.0, so we convert to infinities and try again
492        return 1;      if (x == 0 && y == 0)
493      if (x == -0.0 && y == 0.0)        return (int) (1 / x - 1 / y);
       return -1;  
494      if (x == y)      if (x == y)
495        return 0;        return 0;
496    

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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