/* origin: FreeBSD /usr/src/lib/msun/src/k_cosf.c */1/*2* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].3* Debugged and optimized by Bruce D. Evans.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 this11* software is freely granted, provided that this notice12* is preserved.13* ====================================================14*/1516#include "libm.h"1718/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */19static const double20C0 = -0x1.0000000000000p-1,21C1 = 0x1.5555555555555p-5,22C2 = -0x1.6c16c16c16c17p-10,23C3 = 0x1.a01a01a01a01ap-16,24C4 = -0x1.27e4fb7789f5cp-22;2526float __cosdf(double x)27{28double_t z;2930z = x*x;31if (x > -7.8163146972656250e-03 && x < 7.8163146972656250e-03)32return 1 + C0 * z;33return 1.0 + z * (C0 + z * (C1 + z * (C2 + z * (C3 + z * C4))));34}353637