Details
Description
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.
Attachments
Issue Links
 duplicates

JDK4306749 java.lang.Math.cos/sin results are not within 1ulp on Win98
 Closed
 relates to

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

JDK4294075 java.lang.StrictMath.cos/sin results are not within 1ulp on Win98
 Closed

JDK4287874 kestrel FCS Build M,Following JCK1.3RC1 tests failed with java_plugin on win32
 Closed

JDK4807358 REGRESSION: Performance regression in trigonometric functions
 Closed

JDK4857011 Performance regression in trigonometic functions (very slow StrictMath)
 Closed

JDK4220710 Java 1.2 trig functions mess up on big values
 Closed

JDK7175279 Don't use x87 FPU on x8664
 Resolved