s_cos.c (176385) | s_cos.c (218509) |
---|---|
1/* @(#)s_cos.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> | 1/* @(#)s_cos.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> |
14__FBSDID("$FreeBSD: head/lib/msun/src/s_cos.c 176385 2008-02-18 14:02:12Z bde $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_cos.c 218509 2011-02-10 07:37:50Z das $"); |
15 16/* cos(x) 17 * Return cosine function of x. 18 * 19 * kernel function: 20 * __kernel_sin ... sine function on [-pi/4,pi/4] 21 * __kernel_cos ... cosine function on [-pi/4,pi/4] 22 * __ieee754_rem_pio2 ... argument reduction routine --- 35 unchanged lines hidden (view full) --- 58 int32_t n, ix; 59 60 /* High word of x. */ 61 GET_HIGH_WORD(ix,x); 62 63 /* |x| ~< pi/4 */ 64 ix &= 0x7fffffff; 65 if(ix <= 0x3fe921fb) { | 15 16/* cos(x) 17 * Return cosine function of x. 18 * 19 * kernel function: 20 * __kernel_sin ... sine function on [-pi/4,pi/4] 21 * __kernel_cos ... cosine function on [-pi/4,pi/4] 22 * __ieee754_rem_pio2 ... argument reduction routine --- 35 unchanged lines hidden (view full) --- 58 int32_t n, ix; 59 60 /* High word of x. */ 61 GET_HIGH_WORD(ix,x); 62 63 /* |x| ~< pi/4 */ 64 ix &= 0x7fffffff; 65 if(ix <= 0x3fe921fb) { |
66 if(ix<0x3e400000) /* if x < 2**-27 */ | 66 if(ix<0x3e46a09e) /* if x < 2**-27 * sqrt(2) */ |
67 if(((int)x)==0) return 1.0; /* generate inexact */ 68 return __kernel_cos(x,z); 69 } 70 71 /* cos(Inf or NaN) is NaN */ 72 else if (ix>=0x7ff00000) return x-x; 73 74 /* argument reduction needed */ --- 15 unchanged lines hidden --- | 67 if(((int)x)==0) return 1.0; /* generate inexact */ 68 return __kernel_cos(x,z); 69 } 70 71 /* cos(Inf or NaN) is NaN */ 72 else if (ix>=0x7ff00000) return x-x; 73 74 /* argument reduction needed */ --- 15 unchanged lines hidden --- |