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

On x86 platforms, C2 Math.{sin, cos} implementations violate the 1.3 spec

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      x86
    • OS:
      solaris_7, windows_98

      Description

      In 1.3, the specification for java.lang.Math.{sin, cos} was changed
      from an operational definition (use FDLIBM algorithms) to a
      declarative one (use any approximation with 1 ulp accuracy and good
      monotonicity properties). On x86 platforms, for values smaller in
      magnitude than 2^63, effectively the C1 and C2 compilers use the raw
      x86 instructions fsin and fcos to implement Math.{sin, cos}. This
      does not follow the spec since the 66 bit argument reduction used by
      fsin/fcos introduces large deviations from the true values of sine and
      cosine for some inputs. Outside of +/-2^63, C1 and C2 use FDLIBM
      algorithms which do proper argument reduction. This introduces an
      inconsistency in the periodicity of the approximation to sine/cosine.

      The solution is to have the Math.{sin, cos} do their own argument
      reduction to [-pi/4, pi/4] and then call fsin/fcos; this will
      guarantee the specified accuracy and monotonicity properties. The
      needed argument reduction functions are already available from FDLIBM,
      http://www.netlib.org/fdlibm.

      This bug is filed against C1 as bug id 4345903.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cclicksunw Clifford Click (Inactive)
              Reporter:
              darcy Joe Darcy
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: