Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4035455

Math.abs(-0.0f) and Math.abs(-0.0d) return -0.0f and -0.0d, respectively.

XMLWordPrintable

    • 1.2alpha
    • generic, sparc
    • solaris_2.5.1
    • Not verified


      allan.jacobs@Eng 1997-02-28

      Math.abs(-0.0f) returns -0.0f. Math.abs(-0.0d) returns -0.0d
      in violation of the Java Spec. Turning on the JIT fixes the problem.

      algol% cat zero.java

      class zero {
              public static void main( String[] argv ) {
                      float fz = -0.0F;
                      double dz = -0.0D;
                      System.out.println( Math.abs(fz) );
                      System.out.println( Math.abs(dz) );
              }
      }
      algol% javac zero.java
      algol% java -Djava.compiler=none zero
      -0.0
      -0.0
      algol% java -Djava.compiler=sunwjit zero
      0.0
      0.0

            apalanissunw Anand Palaniswamy (Inactive)
            ajacobssunw Allan Jacobs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: