k_tanf.c (97413) | k_tanf.c (129981) |
---|---|
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 * ==================================================== | 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 (C) 1993 by Sun Microsystems, Inc. All rights reserved. | 7 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. |
8 * | 8 * |
9 * Developed at SunPro, a Sun Microsystems, Inc. business. | |
10 * Permission to use, copy, modify, and distribute this 11 * software is freely granted, provided that this notice 12 * is preserved. 13 * ==================================================== 14 */ 15 16#ifndef lint | 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 |
17static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tanf.c 97413 2002-05-28 18:15:04Z alfred $"; | 16static char rcsid[] = "$FreeBSD: head/lib/msun/src/k_tanf.c 129981 2004-06-02 04:39:44Z das $"; |
18#endif 19 20#include "math.h" 21#include "math_private.h" 22static const float 23one = 1.0000000000e+00, /* 0x3f800000 */ 24pio4 = 7.8539812565e-01, /* 0x3f490fda */ 25pio4lo= 3.7748947079e-08, /* 0x33222168 */ --- 15 unchanged lines hidden (view full) --- 41 42float 43__kernel_tanf(float x, float y, int iy) 44{ 45 float z,r,v,w,s; 46 int32_t ix,hx; 47 GET_FLOAT_WORD(hx,x); 48 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| */ |
49 if(ix<0x31800000) /* x < 2**-28 */ 50 {if((int)x==0) { /* generate inexact */ 51 if((ix|(iy+1))==0) return one/fabsf(x); 52 else return (iy==1)? x: -one/x; 53 } 54 } | 48 if(ix<0x31800000) { /* x < 2**-28 */ 49 if ((int) x == 0) { /* generate inexact */ 50 if ((ix | (iy + 1)) == 0) 51 return one / fabsf(x); 52 else { 53 if (iy == 1) 54 return x; 55 else { /* compute -1 / (x+y) carefully */ 56 double a, t; 57 58 z = w = x + y; 59 GET_FLOAT_WORD(ix, z); 60 SET_FLOAT_WORD(z, ix & 0xfffff000); 61 v = y - (z - x); 62 t = a = -one / w; 63 GET_FLOAT_WORD(ix, t); 64 SET_FLOAT_WORD(t, ix & 0xfffff000); 65 s = one + t * z; 66 return t + a * (s + t * v); 67 } 68 } 69 } 70 } |
55 if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ 56 if(hx<0) {x = -x; y = -y;} 57 z = pio4-x; 58 w = pio4lo-y; 59 x = z+w; y = 0.0; 60 } 61 z = x*x; 62 w = z*z; --- 31 unchanged lines hidden --- | 71 if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ 72 if(hx<0) {x = -x; y = -y;} 73 z = pio4-x; 74 w = pio4lo-y; 75 x = z+w; y = 0.0; 76 } 77 z = x*x; 78 w = z*z; --- 31 unchanged lines hidden --- |