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

Math.acos(1.00000000000000001) returns 0.0, but Math.acos(1.000000001) returns NaN

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u202
    • core-libs
    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10, Java "1.8.0_191" / "1.8.0_202" / "11.0.2".

      A DESCRIPTION OF THE PROBLEM :
      Math.acos(1.00000000000000001) return 0.0 (almost correct).
      But Math.acos(1.000000001) return NaN.
      Why ?
      //not found similar bugs existing.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public static void main(String[] args) {
              System.out.println(Math.acos(1.000000001));//return NaN ?
              System.out.println(Math.acos(1.00000000000000001));//return 0.0 (almost correct)
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      0.0
      0.0
      ACTUAL -
      NaN
      0.0

      ---------- BEGIN SOURCE ----------
      public static void main(String[] args) {
              System.out.println(Math.acos(1.000000001));//return NaN ?
              System.out.println(Math.acos(1.00000000000000001));//return 0.0 (almost correct)
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: