e_atan2f.c (181100) | e_atan2f.c (181204) |
---|---|
1/* e_atan2f.c -- float version of e_atan2.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. 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#include <sys/cdefs.h> | 1/* e_atan2f.c -- float version of e_atan2.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. 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#include <sys/cdefs.h> |
17__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2f.c 181100 2008-08-01 01:24:25Z das $"); | 17__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2f.c 181204 2008-08-02 19:17:00Z das $"); |
18 19#include "math.h" 20#include "math_private.h" 21 22static volatile float 23tiny = 1.0e-30; 24static const float 25zero = 0.0, --- 49 unchanged lines hidden (view full) --- 75 } 76 } 77 } 78 /* when y is INF */ 79 if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; 80 81 /* compute y/x */ 82 k = (iy-ix)>>23; | 18 19#include "math.h" 20#include "math_private.h" 21 22static volatile float 23tiny = 1.0e-30; 24static const float 25zero = 0.0, --- 49 unchanged lines hidden (view full) --- 75 } 76 } 77 } 78 /* when y is INF */ 79 if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; 80 81 /* compute y/x */ 82 k = (iy-ix)>>23; |
83 if(k > 26) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**26 */ 84 else if(hx<0&&k<-26) z=0.0; /* |y|/x < -2**26 */ | 83 if(k > 26) { /* |y/x| > 2**26 */ 84 z=pi_o_2+(float)0.5*pi_lo; 85 m&=1; 86 } 87 else if(hx<0&&k<-26) z=0.0; /* 0 > |y|/x > -2**-26 */ |
85 else z=atanf(fabsf(y/x)); /* safe to do y/x */ 86 switch (m) { 87 case 0: return z ; /* atan(+,+) */ | 88 else z=atanf(fabsf(y/x)); /* safe to do y/x */ 89 switch (m) { 90 case 0: return z ; /* atan(+,+) */ |
88 case 1: { 89 u_int32_t zh; 90 GET_FLOAT_WORD(zh,z); 91 SET_FLOAT_WORD(z,zh ^ 0x80000000); 92 } 93 return z ; /* atan(-,+) */ | 91 case 1: return -z ; /* atan(-,+) */ |
94 case 2: return pi-(z-pi_lo);/* atan(+,-) */ 95 default: /* case 3 */ 96 return (z-pi_lo)-pi;/* atan(-,-) */ 97 } 98} | 92 case 2: return pi-(z-pi_lo);/* atan(+,-) */ 93 default: /* case 3 */ 94 return (z-pi_lo)-pi;/* atan(-,-) */ 95 } 96} |