Other |
---|
1.3.1 betaFixed |
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.
|