version 1.4, 1994/03/03 17:04:27 |
version 1.9, 1997/10/09 11:30:56 |
|
|
* ==================================================== |
* ==================================================== |
*/ |
*/ |
|
|
#ifndef lint |
#include <sys/cdefs.h> |
static char rcsid[] = "$Id$"; |
#if defined(LIBM_SCCS) && !defined(lint) |
|
__RCSID("$NetBSD$"); |
#endif |
#endif |
|
|
/* atan(x) |
/* atan(x) |
Line 34 static char rcsid[] = "$Id$"; |
|
Line 35 static char rcsid[] = "$Id$"; |
|
* to produce the hexadecimal values shown. |
* to produce the hexadecimal values shown. |
*/ |
*/ |
|
|
#include <math.h> |
#include "math.h" |
#include <machine/endian.h> |
#include "math_private.h" |
|
|
#if BYTE_ORDER == LITTLE_ENDIAN |
|
#define n0 1 |
|
#else |
|
#define n0 0 |
|
#endif |
|
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static const double atanhi[] = { |
static const double atanhi[] = { |
|
|
#endif |
#endif |
{ |
{ |
double w,s1,s2,z; |
double w,s1,s2,z; |
int ix,hx,id; |
int32_t ix,hx,id; |
|
|
hx = *(n0+(int*)&x); |
GET_HIGH_WORD(hx,x); |
ix = hx&0x7fffffff; |
ix = hx&0x7fffffff; |
if(ix>=0x44100000) { /* if |x| >= 2^66 */ |
if(ix>=0x44100000) { /* if |x| >= 2^66 */ |
|
u_int32_t low; |
|
GET_LOW_WORD(low,x); |
if(ix>0x7ff00000|| |
if(ix>0x7ff00000|| |
(ix==0x7ff00000&&(*(1-n0+(int*)&x)!=0))) |
(ix==0x7ff00000&&(low!=0))) |
return x+x; /* NaN */ |
return x+x; /* NaN */ |
if(hx>0) return atanhi[3]+atanlo[3]; |
if(hx>0) return atanhi[3]+atanlo[3]; |
else return -atanhi[3]-atanlo[3]; |
else return -atanhi[3]-atanlo[3]; |