Deleted Added
full compact
k_cosf.c (151698) k_cosf.c (151796)
1/* k_cosf.c -- float version of k_cos.c
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
1/* k_cosf.c -- float version of k_cos.c
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 * Debugged and optimized by Bruce D. Evans.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
14 */
15
16#ifndef lint
4 */
5
6/*
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 *
10 * Developed at SunPro, a Sun Microsystems, Inc. business.
11 * Permission to use, copy, modify, and distribute this
12 * software is freely granted, provided that this notice
13 * is preserved.
14 * ====================================================
15 */
16
17#ifndef lint
17static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cosf.c 151698 2005-10-26 12:36:18Z bde $";
18static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cosf.c 151796 2005-10-28 13:36:58Z bde $";
18#endif
19
20#include "math.h"
21#include "math_private.h"
22
19#endif
20
21#include "math.h"
22#include "math_private.h"
23
24/* Range of maximum relative error in polynomial: ~[-1.15e-10, 1.169e-10]. */
23static const float
25static const float
24one = 1.0000000000e+00, /* 0x3f800000 */
25C1 = 4.1666667908e-02, /* 0x3d2aaaab */
26C2 = -1.3888889225e-03, /* 0xbab60b61 */
27C3 = 2.4801587642e-05, /* 0x37d00d01 */
28C4 = -2.7557314297e-07, /* 0xb493f27c */
29C5 = 2.0875723372e-09, /* 0x310f74f6 */
30C6 = -1.1359647598e-11; /* 0xad47d74e */
26one = 1.0,
27C1 = 0xaaaaa5.0p-28, /* 0.04166664555668830871582031250 */
28C2 = -0xb60615.0p-33, /* -0.001388731063343584537506103516 */
29C3 = 0xccf47d.0p-39; /* 0.00002443254288664320483803749084 */
31
32float
33__kernel_cosf(float x, float y)
34{
35 float hz,z,r,w;
36
37 z = x*x;
30
31float
32__kernel_cosf(float x, float y)
33{
34 float hz,z,r,w;
35
36 z = x*x;
38 r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
37 r = z*(C1+z*(C2+z*C3));
39 hz = (float)0.5*z;
40 w = one-hz;
41 return w + (((one-w)-hz) + (z*r-x*y));
42}
38 hz = (float)0.5*z;
39 w = one-hz;
40 return w + (((one-w)-hz) + (z*r-x*y));
41}