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

Widen allowable error bound of Math.tan

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • core-libs
    • None
    • minimal
    • Update spec to cover existing behavior.
    • Java API
    • SE

      Summary

      Widen allowable error bound of Math.tan to accommodate a demonstrated worst-case error bound slightly outside of the currently allowable range.

      Problem

      Recent work (https://members.loria.fr/PZimmermann/papers/accuracy.pdf) has found a worst-case error bound for an FDLIBM-derived math library that is slightly outside of the analytically understood worst-case.

      Solution

      Widen the stated error bound from less than 1 ulp to less than 1.25 ulps, which would allow the 1.02 ulps worst-case observed bound.

      Specification

      diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java
      index 11c636c8434..fa45b6436c7 100644
      --- a/src/java.base/share/classes/java/lang/Math.java
      +++ b/src/java.base/share/classes/java/lang/Math.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -212,7 +212,7 @@ public static double cos(double a) {
            * <li>If the argument is zero, then the result is a zero with the
            * same sign as the argument.</ul>
            *
      -     * <p>The computed result must be within 1 ulp of the exact result.
      +     * <p>The computed result must be within 1.25 ulps of the exact result.
            * Results must be semi-monotonic.
            *
            * @param   a   an angle, in radians.

            darcy Joe Darcy
            darcy Joe Darcy
            Brian Burkhalter, Raffaello Giulietti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: