1994-08-19 09:40:01 +00:00
|
|
|
/* k_cosf.c -- float version of k_cos.c
|
|
|
|
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ====================================================
|
|
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
|
* Permission to use, copy, modify, and distribute this
|
1995-05-30 05:51:47 +00:00
|
|
|
* software is freely granted, provided that this notice
|
1994-08-19 09:40:01 +00:00
|
|
|
* is preserved.
|
|
|
|
* ====================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
1999-08-28 00:22:10 +00:00
|
|
|
static char rcsid[] = "$FreeBSD$";
|
1994-08-19 09:40:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math.h"
|
|
|
|
#include "math_private.h"
|
|
|
|
|
1995-05-30 05:51:47 +00:00
|
|
|
static const float
|
1994-08-19 09:40:01 +00:00
|
|
|
one = 1.0000000000e+00, /* 0x3f800000 */
|
|
|
|
C1 = 4.1666667908e-02, /* 0x3d2aaaab */
|
|
|
|
C2 = -1.3888889225e-03, /* 0xbab60b61 */
|
|
|
|
C3 = 2.4801587642e-05, /* 0x37d00d01 */
|
|
|
|
C4 = -2.7557314297e-07, /* 0xb493f27c */
|
|
|
|
C5 = 2.0875723372e-09, /* 0x310f74f6 */
|
|
|
|
C6 = -1.1359647598e-11; /* 0xad47d74e */
|
|
|
|
|
2002-05-28 18:15:04 +00:00
|
|
|
float
|
|
|
|
__kernel_cosf(float x, float y)
|
1994-08-19 09:40:01 +00:00
|
|
|
{
|
2005-10-26 12:36:18 +00:00
|
|
|
float hz,z,r,w;
|
|
|
|
|
1994-08-19 09:40:01 +00:00
|
|
|
z = x*x;
|
|
|
|
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
|
2005-10-26 12:36:18 +00:00
|
|
|
hz = (float)0.5*z;
|
|
|
|
w = one-hz;
|
|
|
|
return w + (((one-w)-hz) + (z*r-x*y));
|
1994-08-19 09:40:01 +00:00
|
|
|
}
|