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

Math.cos() gives different results when intrinsics are disabled.

    XMLWordPrintable

Details

    • b140
    • 9

    Description

      ADDITIONAL SYSTEM INFORMATION :
      ~$ uname -a
      Linux sandy 3.16.0-10-amd64 #1 SMP Debian 3.16.81-1 (2020-01-17) x86_64 GNU/Linux
      ~$ java -version
      java version "14" 2020-03-17
      Java(TM) SE Runtime Environment (build 14+36-1461)
      Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      Math.cos() gives different results when intrinsics are disabled. For example, when intrinsics are enabled, Math.cos(-15.085052295396792) = -0.8121836333436737. When the _dcos intrinsic is disabled, Math.cos(-15.085052295396792) = -0.8121836333436738. One of these is not within 1 ulp of the actual result.

      REGRESSION : Last worked in version 8u241

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test case below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected both results to be equal.
      ACTUAL -
      The results differed in the last decimal place.

      ---------- BEGIN SOURCE ----------
      public class Cosine {
        public static void main(String[]args) {
          System.out.println("Math.cos(-15.085052295396792) = " + Math.cos(-15.085052295396792));
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Disable intrinsics:
      -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_dcos

      FREQUENCY : always


      Attachments

        Activity

          People

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: