Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4345903
Votes 0
Synopsis On x86 platforms, C1 Math.{sin, cos} implementations violate the 1.3 spec
Category hotspot:compiler1
Reported Against 1.3fcs , kestrel , kestrel-rc3
Release Fixed 1.4(merlin-beta2)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 4220710 , 4287874 , 4294075 , 4306749 , 4345910 , 4800481 , 4807358 , 4857011
Submit Date 15-JUN-2000
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  customer 
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.
Work Around
Use the methods in the FDLIBM-based java.lang.StrictMath to implement java.lang.Math.
Evaluation
Fixed for merlin beta refresh. Interpreter code has been changed to an inlined
routine and revised to be more efficient based on suggestions from   xxxxx@xxxxx  
and   xxxxx@xxxxx  ; C1 now uses this code as well.

  xxxxx@xxxxx   2001-04-27
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang