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

x * x computes wrong value in strictfp mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • hotspot
    • None
    • b46
    • sparc
    • solaris_9

      There appears to be a longstanding problem with strict multiplies in C2. It looks like the rule for strict multiplies doesn't work right if src == dst. Here's a test case:

      public class strictsqr {
          static strictfp double strictsqr(double x) {
              return x*x;
          }

          final static int limit = 10000000;
          public static void main(String[] args) {
              for (int i = 0; i < 20; i ++) {
                  double x = i / (double)limit;
                  System.out.println(strictsqr.strictsqr(x));
              }
          }
      }

      java -server -XX:UseSSE=0 -Xcomp strictsqr will output all zeros instead of the correct output in which only the first value is zero. This fails all the way back to 1.4.2.

            azeemj Azeem Jiva
            never Tom Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: