Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntimeTrig.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | 8a9bb7821e28 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
221 * | 221 * |
222 * iq[] integer array by breaking up q[] in 24-bits chunk. | 222 * iq[] integer array by breaking up q[] in 24-bits chunk. |
223 * | 223 * |
224 * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] | 224 * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] |
225 * | 225 * |
226 * ih integer. If >0 it indicates q[] is >= 0.5, hence | 226 * ih integer. If >0 it indicats q[] is >= 0.5, hence |
227 * it also indicates the *sign* of the result. | 227 * it also indicates the *sign* of the result. |
228 * | 228 * |
229 */ | 229 */ |
230 | 230 |
231 | 231 |
345 | 345 |
346 /* chop off zero terms */ | 346 /* chop off zero terms */ |
347 if(z==0.0) { | 347 if(z==0.0) { |
348 jz -= 1; q0 -= 24; | 348 jz -= 1; q0 -= 24; |
349 while(iq[jz]==0) { jz--; q0-=24;} | 349 while(iq[jz]==0) { jz--; q0-=24;} |
350 } else { /* break z into 24-bit if necessary */ | 350 } else { /* break z into 24-bit if neccessary */ |
351 z = scalbnA(z,-q0); | 351 z = scalbnA(z,-q0); |
352 if(z>=two24B) { | 352 if(z>=two24B) { |
353 fw = (double)((int)(twon24*z)); | 353 fw = (double)((int)(twon24*z)); |
354 iq[jz] = (int)(z-two24B*fw); | 354 iq[jz] = (int)(z-two24B*fw); |
355 jz += 1; q0 += 24; | 355 jz += 1; q0 += 24; |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 /* | 410 /* |
411 * ==================================================== | 411 * ==================================================== |
412 * Copyright (c) 1993 Oracle and/or its affiliates. All rights reserved. | 412 * Copyright (c) 1993 Oracle and/or its affilates. All rights reserved. |
413 * | 413 * |
414 * Developed at SunPro, a Sun Microsystems, Inc. business. | 414 * Developed at SunPro, a Sun Microsystems, Inc. business. |
415 * Permission to use, copy, modify, and distribute this | 415 * Permission to use, copy, modify, and distribute this |
416 * software is freely granted, provided that this notice | 416 * software is freely granted, provided that this notice |
417 * is preserved. | 417 * is preserved. |
656 C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ | 656 C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ |
657 C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ | 657 C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ |
658 | 658 |
659 static double __kernel_cos(double x, double y) | 659 static double __kernel_cos(double x, double y) |
660 { | 660 { |
661 double a,h,z,r,qx; | 661 double a,hz,z,r,qx; |
662 int ix; | 662 int ix; |
663 ix = __HI(x)&0x7fffffff; /* ix = |x|'s high word*/ | 663 ix = __HI(x)&0x7fffffff; /* ix = |x|'s high word*/ |
664 if(ix<0x3e400000) { /* if x < 2**27 */ | 664 if(ix<0x3e400000) { /* if x < 2**27 */ |
665 if(((int)x)==0) return one; /* generate inexact */ | 665 if(((int)x)==0) return one; /* generate inexact */ |
666 } | 666 } |
673 qx = 0.28125; | 673 qx = 0.28125; |
674 } else { | 674 } else { |
675 __HI(qx) = ix-0x00200000; /* x/4 */ | 675 __HI(qx) = ix-0x00200000; /* x/4 */ |
676 __LO(qx) = 0; | 676 __LO(qx) = 0; |
677 } | 677 } |
678 h = 0.5*z-qx; | 678 hz = 0.5*z-qx; |
679 a = one-qx; | 679 a = one-qx; |
680 return a - (h - (z*r-x*y)); | 680 return a - (hz - (z*r-x*y)); |
681 } | 681 } |
682 } | 682 } |
683 | 683 |
684 /* __kernel_tan( x, y, k ) | 684 /* __kernel_tan( x, y, k ) |
685 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 | 685 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 |