freebsd-skq/lib/msun/src/k_cosf.c

43 lines
1.1 KiB
C
Raw Normal View History

/* 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
* is preserved.
* ====================================================
*/
#ifndef lint
1999-08-28 00:22:10 +00:00
static char rcsid[] = "$FreeBSD$";
#endif
#include "math.h"
#include "math_private.h"
1995-05-30 05:51:47 +00:00
static const float
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 */
float
__kernel_cosf(float x, float y)
{
float hz,z,r,w;
z = x*x;
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
hz = (float)0.5*z;
w = one-hz;
return w + (((one-w)-hz) + (z*r-x*y));
}