k_tanf.c (151963) | k_tanf.c (151969) |
---|---|
1/* k_tanf.c -- float version of k_tan.c 2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3 */ 4 5/* 6 * ==================================================== 7 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. 8 * 9 * Permission to use, copy, modify, and distribute this 10 * software is freely granted, provided that this notice 11 * is preserved. 12 * ==================================================== 13 */ 14 15#ifndef lint | 1/* k_tanf.c -- float version of k_tan.c 2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3 */ 4 5/* 6 * ==================================================== 7 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. 8 * 9 * Permission to use, copy, modify, and distribute this 10 * software is freely granted, provided that this notice 11 * is preserved. 12 * ==================================================== 13 */ 14 15#ifndef lint |
16static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tanf.c 151963 2005-11-02 06:45:21Z bde $"; | 16static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tanf.c 151969 2005-11-02 14:01:45Z bde $"; |
17#endif 18 19#include "math.h" 20#include "math_private.h" 21static const float 22one = 1.0000000000e+00, /* 0x3f800000 */ 23pio4 = 7.8539812565e-01, /* 0x3f490fda */ 24pio4lo= 3.7748947079e-08, /* 0x33222168 */ --- 15 unchanged lines hidden (view full) --- 40 41float 42__kernel_tanf(float x, float y, int iy) 43{ 44 float z,r,v,w,s; 45 int32_t ix,hx; 46 GET_FLOAT_WORD(hx,x); 47 ix = hx&0x7fffffff; /* high word of |x| */ | 17#endif 18 19#include "math.h" 20#include "math_private.h" 21static const float 22one = 1.0000000000e+00, /* 0x3f800000 */ 23pio4 = 7.8539812565e-01, /* 0x3f490fda */ 24pio4lo= 3.7748947079e-08, /* 0x33222168 */ --- 15 unchanged lines hidden (view full) --- 40 41float 42__kernel_tanf(float x, float y, int iy) 43{ 44 float z,r,v,w,s; 45 int32_t ix,hx; 46 GET_FLOAT_WORD(hx,x); 47 ix = hx&0x7fffffff; /* high word of |x| */ |
48 if(ix<0x31800000) { /* x < 2**-28 */ 49 if ((int) x == 0) { /* generate inexact */ 50 { 51 if (iy == 1) 52 return x; 53 else { /* compute -1 / (x+y) carefully */ 54 float a, t; 55 56 z = w = x + y; 57 GET_FLOAT_WORD(ix, z); 58 SET_FLOAT_WORD(z, ix & 0xfffff000); 59 v = y - (z - x); 60 t = a = -one / w; 61 GET_FLOAT_WORD(ix, t); 62 SET_FLOAT_WORD(t, ix & 0xfffff000); 63 s = one + t * z; 64 return t + a * (s + t * v); 65 } 66 } 67 } 68 } | |
69 if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ 70 if(hx<0) {x = -x; y = -y;} 71 z = pio4-x; 72 w = pio4lo-y; 73 x = z+w; y = 0.0; 74 } 75 z = x*x; 76 w = z*z; --- 31 unchanged lines hidden --- | 48 if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ 49 if(hx<0) {x = -x; y = -y;} 50 z = pio4-x; 51 w = pio4lo-y; 52 x = z+w; y = 0.0; 53 } 54 z = x*x; 55 w = z*z; --- 31 unchanged lines hidden --- |