United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5033578 : Java should require use of latest fdlibm 5.3

Details
Type:
Bug
Submit Date:
2004-04-19
Status:
Resolved
Updated Date:
2004-05-11
Project Name:
JDK
Resolved Date:
2004-05-11
Component:
core-libs
OS:
generic,windows_2000
Sub-Component:
java.lang
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.2,5.0
Fixed Versions:
5.0 (b51)

Related Reports
Duplicate:

Sub Tasks

Description
For many years, Java has required use of the algorithms from fdlibm 5.2.  However, fdlibm 5.2 has several bugs in corner cases of pow and tan.  Now that a corrected version of fdlibm is available, the StrictMath spec should be updated to require the corrected fdlibm.

                                    

Comments
EVALUATION

Should be fixed in Tiger.

###@###.### 2004-04-18
                                     
2004-04-18
SUGGESTED FIX

src/share/classes/java/lang>sccs sccsdiff -r1.24 -r1.25 StrictMath.java

------- StrictMath.java -------
28,40c28,39
<  * <p>The Java math library is defined with respect to the version of
<  * <code>fdlibm</code> dated January 4, 1995. Where
<  * <code>fdlibm</code> provides more than one definition for a
<  * function (such as <code>acos</code>), use the "IEEE 754 core
<  * function" version (residing in a file whose name begins with the
<  * letter <code>e</code>).  The methods which require
<  * <code>fdlibm</code> semantics are <code>sin</code>,
<  * <code>cos</code>, <code>tan</code>, <code>asin</code>,
<  * <code>acos</code>, <code>atan</code>, <code>exp</code>,
<  * <code>log</code>, <code>log10</code>, <code>cbrt</code>,
<  * <code>atan2</code>, <code>pow</code>, <code>sinh</code>,
<  * <code>cosh</code>, <code>tanh</code>, <code>hypot</code>,
<  * <code>expm1</code>, and <code>log1p</code>.
---
>  * <p>The Java math library is defined with respect to
>  * <code>fdlibm</code> version 5.3. Where <code>fdlibm</code> provides
>  * more than one definition for a function (such as
>  * <code>acos</code>), use the "IEEE 754 core function" version
>  * (residing in a file whose name begins with the letter
>  * <code>e</code>).  The methods which require <code>fdlibm</code>
>  * semantics are <code>sin</code>, <code>cos</code>, <code>tan</code>,
>  * <code>asin</code>, <code>acos</code>, <code>atan</code>,
>  * <code>exp</code>, <code>log</code>, <code>log10</code>,
>  * <code>cbrt</code>, <code>atan2</code>, <code>pow</code>,
>  * <code>sinh</code>, <code>cosh</code>, <code>tanh</code>,
>  * <code>hypot</code>, <code>expm1</code>, and <code>log1p</code>.
src/share/native/java/lang/fdlibm/src>sccs sccsdiff -r1.9 -r1.10 e_pow.c

------- e_pow.c -------
103c103
<       int i,j,k,yisint,n;
---
>       int i0,i1,i,j,k,yisint,n;
106a107
>       i0 = ((*(int*)&one)>>29)^1; i1=1-i0;
174a176,177
>       n = (hx>>31)+1;
> 
176c179
<       if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
---
>       if((n|yisint)==0) return (x-x)/(x-x);
177a181,183
>       s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
>       if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */
> 
185,186c191,192
<           if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
<           if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
---
>           if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny;
>           if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny;
189c195
<           t = x-1;            /* t has 20 trailing zeros */
---
>           t = ax-one;         /* t has 20 trailing zeros */
197c203
<           double s2,s_h,s_l,t_h,t_l;
---
>           double ss,s2,s_h,s_l,t_h,t_l;
211c217
<       /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
---
>       /* compute ss = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
214,215c220,221
<           s = u*v;
<           s_h = s;
---
>           ss = u*v;
>           s_h = ss;
223c229
<           s2 = s*s;
---
>           s2 = ss*ss;
225c231
<           r += s_l*(s_h+s);
---
>           r += s_l*(s_h+ss);
230c236
<       /* u+v = s*(1+...) */
---
>       /* u+v = ss*(1+...) */
232,233c238,239
<           v = s_l*t_h+t_l*s;
<       /* 2/(3log2)*(s+...) */
---
>           v = s_l*t_h+t_l*ss;
>       /* 2/(3log2)*(ss+...) */
239c245
<       /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
---
>       /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
246,248d251
<       s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
<       if((((hx>>31)+1)|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */
< 
src/share/native/java/lang/fdlibm/src>sccs sccsdiff -r1.8 -r1.9 k_tan.c 

------- k_tan.c -------
80,85c80,100
<       if(ix<0x3e300000)                       /* x < 2**-28 */
<           {if((int)x==0) {                    /* generate inexact */
<               if(((ix|__LO(x))|(iy+1))==0) return one/fabs(x);
<               else return (iy==1)? x: -one/x;
<           }
<           }
---
>       if(ix<0x3e300000) {                     /* x < 2**-28 */
>         if((int)x==0) {                       /* generate inexact */
>           if (((ix | __LO(x)) | (iy + 1)) == 0)
>             return one / fabs(x);
>           else {
>             if (iy == 1)
>               return x;
>             else {    /* compute -1 / (x+y) carefully */
>               double a, t;
> 
>               z = w = x + y;
>               __LO(z) = 0;
>               v = y - (z - x);
>               t = a = -one / w;
>               __LO(t) = 0;
>               s = one + t * z;
>               return t + a * (s + t * v);
>               }
>             }
>         }
>       }

###@###.### 2004-04-28
                                     
2004-04-28
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger-beta2

FIXED IN:
tiger-beta2

INTEGRATED IN:
tiger-b51
tiger-beta2


                                     
2004-06-14



Hardware and Software, Engineered to Work Together