Deleted Added
full compact
k_cosf.c (152340) k_cosf.c (152647)
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.
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
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.
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 INLINE_KERNEL_COSF
17#ifndef lint
18#ifndef lint
18static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cosf.c 152340 2005-11-12 19:54:45Z bde $";
19static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_cosf.c 152647 2005-11-21 04:57:12Z bde $";
19#endif
20#endif
21#endif
20
21#include "math.h"
22#include "math_private.h"
23
24/* |cos(x) - c(x)| < 2**-33.1 (~[-9.39e-11, 1.083e-10]). */
25static const float
26one = 1.0,
27C1 = 0xaaaaa5.0p-28, /* 0.041666645557 */
28C2 = -0xb60615.0p-33, /* -0.0013887310633 */
29C3 = 0xccf47d.0p-39; /* 0.000024432542887 */
30
22
23#include "math.h"
24#include "math_private.h"
25
26/* |cos(x) - c(x)| < 2**-33.1 (~[-9.39e-11, 1.083e-10]). */
27static const float
28one = 1.0,
29C1 = 0xaaaaa5.0p-28, /* 0.041666645557 */
30C2 = -0xb60615.0p-33, /* -0.0013887310633 */
31C3 = 0xccf47d.0p-39; /* 0.000024432542887 */
32
33#ifdef INLINE_KERNEL_COSF
34extern inline
35#endif
31float
32__kernel_cosf(float x, float y)
33{
34 float hz,z,r,w;
35
36 z = x*x;
37 r = z*(C1+z*(C2+z*C3));
38 hz = (float)0.5*z;
39 w = one-hz;
40 return w + (((one-w)-hz) + (z*r-x*y));
41}
36float
37__kernel_cosf(float x, float y)
38{
39 float hz,z,r,w;
40
41 z = x*x;
42 r = z*(C1+z*(C2+z*C3));
43 hz = (float)0.5*z;
44 w = one-hz;
45 return w + (((one-w)-hz) + (z*r-x*y));
46}