e_atan2l.c (181152) | e_atan2l.c (181204) |
---|---|
1 2/* @(#)e_atan2.c 1.3 95/01/18 */ 3/* FreeBSD: head/lib/msun/src/e_atan2.c 176451 2008-02-22 02:30:36Z das */ 4/* 5 * ==================================================== 6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 7 * 8 * Developed at SunSoft, a Sun Microsystems, Inc. business. 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 16#include <sys/cdefs.h> | 1 2/* @(#)e_atan2.c 1.3 95/01/18 */ 3/* FreeBSD: head/lib/msun/src/e_atan2.c 176451 2008-02-22 02:30:36Z das */ 4/* 5 * ==================================================== 6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 7 * 8 * Developed at SunSoft, a Sun Microsystems, Inc. business. 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 16#include <sys/cdefs.h> |
17__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2l.c 181152 2008-08-02 03:56:22Z das $"); | 17__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2l.c 181204 2008-08-02 19:17:00Z das $"); |
18 19/* 20 * See comments in e_atan2.c. 21 * Converted to long double by David Schultz <das@FreeBSD.ORG>. 22 */ 23 24#include <float.h> 25 --- 73 unchanged lines hidden (view full) --- 99 } 100 } 101 /* when y is INF */ 102 if(expty==BIAS+LDBL_MAX_EXP) 103 return (expsigny<0)? -pio2_hi-tiny: pio2_hi+tiny; 104 105 /* compute y/x */ 106 k = expty-exptx; | 18 19/* 20 * See comments in e_atan2.c. 21 * Converted to long double by David Schultz <das@FreeBSD.ORG>. 22 */ 23 24#include <float.h> 25 --- 73 unchanged lines hidden (view full) --- 99 } 100 } 101 /* when y is INF */ 102 if(expty==BIAS+LDBL_MAX_EXP) 103 return (expsigny<0)? -pio2_hi-tiny: pio2_hi+tiny; 104 105 /* compute y/x */ 106 k = expty-exptx; |
107 if(k > LDBL_MANT_DIG+2) z=pio2_hi+pio2_lo; /* |y/x| huge */ | 107 if(k > LDBL_MANT_DIG+2) { /* |y/x| huge */ 108 z=pio2_hi+pio2_lo; 109 m&=1; 110 } |
108 else if(expsignx<0&&k<-LDBL_MANT_DIG-2) z=0.0; /* |y/x| tiny, x<0 */ 109 else z=atanl(fabsl(y/x)); /* safe to do y/x */ 110 switch (m) { 111 case 0: return z ; /* atan(+,+) */ 112 case 1: return -z ; /* atan(-,+) */ 113 case 2: return pi-(z-pi_lo);/* atan(+,-) */ 114 default: /* case 3 */ 115 return (z-pi_lo)-pi;/* atan(-,-) */ 116 } 117} | 111 else if(expsignx<0&&k<-LDBL_MANT_DIG-2) z=0.0; /* |y/x| tiny, x<0 */ 112 else z=atanl(fabsl(y/x)); /* safe to do y/x */ 113 switch (m) { 114 case 0: return z ; /* atan(+,+) */ 115 case 1: return -z ; /* atan(-,+) */ 116 case 2: return pi-(z-pi_lo);/* atan(+,-) */ 117 default: /* case 3 */ 118 return (z-pi_lo)-pi;/* atan(-,-) */ 119 } 120} |