s_atan.c (181062) | s_atan.c (181074) |
---|---|
1/* @(#)s_atan.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_atan.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_atan.c 181062 2008-07-31 19:57:50Z das $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_atan.c 181074 2008-07-31 22:41:26Z das $"); |
15 16/* atan(x) 17 * Method 18 * 1. Reduce x to positive by atan(x) = -atan(-x). 19 * 2. According to the integer k=4t+0.25 chopped, t=x, the argument 20 * is further reduced to one of the following intervals and the 21 * arctangent of t is evaluated by the corresponding formula: 22 * --- 5 unchanged lines hidden (view full) --- 28 * 29 * Constants: 30 * The hexadecimal values are the intended ones for the following 31 * constants. The decimal values may be used, provided that the 32 * compiler will convert from decimal to binary accurately enough 33 * to produce the hexadecimal values shown. 34 */ 35 | 15 16/* atan(x) 17 * Method 18 * 1. Reduce x to positive by atan(x) = -atan(-x). 19 * 2. According to the integer k=4t+0.25 chopped, t=x, the argument 20 * is further reduced to one of the following intervals and the 21 * arctangent of t is evaluated by the corresponding formula: 22 * --- 5 unchanged lines hidden (view full) --- 28 * 29 * Constants: 30 * The hexadecimal values are the intended ones for the following 31 * constants. The decimal values may be used, provided that the 32 * compiler will convert from decimal to binary accurately enough 33 * to produce the hexadecimal values shown. 34 */ 35 |
36#include <float.h> 37 |
|
36#include "math.h" 37#include "math_private.h" 38 39static const double atanhi[] = { 40 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ 41 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ 42 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ 43 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ --- 67 unchanged lines hidden (view full) --- 111 s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); 112 s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); 113 if (id<0) return x - x*(s1+s2); 114 else { 115 z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); 116 return (hx<0)? -z:z; 117 } 118} | 38#include "math.h" 39#include "math_private.h" 40 41static const double atanhi[] = { 42 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ 43 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ 44 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ 45 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ --- 67 unchanged lines hidden (view full) --- 113 s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); 114 s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); 115 if (id<0) return x - x*(s1+s2); 116 else { 117 z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); 118 return (hx<0)? -z:z; 119 } 120} |
121 122#if LDBL_MANT_DIG == 53 123__weak_reference(atan, atanl); 124#endif |
|