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

wrong work of the Math.IEEEremainder method in Windows NT

XMLWordPrintable

    • 1.2beta4
    • x86, sparc
    • solaris_2.4, windows_95
    • Not verified



      Name: swC45995 Date: 01/29/97


      In Windows NT the the Math.IEEEremainder method wrongly computes the
      IEEE 754 remainder operation. According the IEEE 754 standard:

      ... the remainder value is mathematically equal to x - y * n where n
      is the mathematical integer closest to the exact mathematical value of
      the quatient x / y; if two mathematical integers are equally close to
      x / y then n is the integer that is even. (JLS, #20.11.14)

      Thus the IEEE remainder operation on the operands 9.0f and 3.0f must
      produce -3.0f as the result. However compilation and subsequent execution
      of the test:

      public class test
      {
      public static void main(String argv[])
      {
      float f = 9.0f;

      System.out.println(Math.IEEEremainder(f, 6.0f))
      }
      }

      produces the following output:

      novo40% javac test.java
      novo40% java test
      3.0

      instead of expected:

      -3.0

      ======================================================================

            hongzh Hong Zhang
            wensunw Wen Wen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: