Deleted Added
full compact
k_cos.c (141296) k_cos.c (151620)
1
2/* @(#)k_cos.c 1.3 95/01/18 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunSoft, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14#ifndef lint
1
2/* @(#)k_cos.c 1.3 95/01/18 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunSoft, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14#ifndef lint
15static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cos.c 141296 2005-02-04 18:26:06Z das $";
15static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cos.c 151620 2005-10-24 14:08:36Z bde $";
16#endif
17
18/*
19 * __kernel_cos( x, y )
20 * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
21 * Input x is assumed to be bounded by ~pi/4 in magnitude.
22 * Input y is the tail of x.
23 *

--- 40 unchanged lines hidden (view full) ---

64
65double
66__kernel_cos(double x, double y)
67{
68 double a,hz,z,r,qx;
69 int32_t ix;
70 GET_HIGH_WORD(ix,x);
71 ix &= 0x7fffffff; /* ix = |x|'s high word*/
16#endif
17
18/*
19 * __kernel_cos( x, y )
20 * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
21 * Input x is assumed to be bounded by ~pi/4 in magnitude.
22 * Input y is the tail of x.
23 *

--- 40 unchanged lines hidden (view full) ---

64
65double
66__kernel_cos(double x, double y)
67{
68 double a,hz,z,r,qx;
69 int32_t ix;
70 GET_HIGH_WORD(ix,x);
71 ix &= 0x7fffffff; /* ix = |x|'s high word*/
72 if(ix<0x3e400000) { /* if x < 2**27 */
73 if(((int)x)==0) return one; /* generate inexact */
74 }
75 z = x*x;
76 r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
77 if(ix < 0x3FD33333) /* if |x| < 0.3 */
78 return one - (0.5*z - (z*r - x*y));
79 else {
80 if(ix > 0x3fe90000) { /* x > 0.78125 */
81 qx = 0.28125;
82 } else {
83 INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */
84 }
85 hz = 0.5*z-qx;
86 a = one-qx;
87 return a - (hz - (z*r-x*y));
88 }
89}
72 z = x*x;
73 r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
74 if(ix < 0x3FD33333) /* if |x| < 0.3 */
75 return one - (0.5*z - (z*r - x*y));
76 else {
77 if(ix > 0x3fe90000) { /* x > 0.78125 */
78 qx = 0.28125;
79 } else {
80 INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */
81 }
82 hz = 0.5*z-qx;
83 a = one-qx;
84 return a - (hz - (z*r-x*y));
85 }
86}