00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#if defined(LIBM_SCCS) && !defined(lint)
00014
static char rcsid[] =
"$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
00015
#endif
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
#include "math.h"
00036
#include "mathP.h"
00037
00038
#ifdef __STDC__
00039
static const double one = 1.0, huge = 1e300;
00040
#else
00041 static double one = 1.0, huge = 1e300;
00042
#endif
00043
00044
#ifdef __STDC__
00045
static const double zero = 0.0;
00046
#else
00047 static double zero = 0.0;
00048
#endif
00049
00050
#ifdef __STDC__
00051
double __ieee754_atanh(
double x)
00052 #
else
00053 double __ieee754_atanh(x)
00054 double x;
00055 #endif
00056 {
00057
double t;
00058 int32_t hx,ix;
00059 u_int32_t lx;
00060
EXTRACT_WORDS(hx,lx,x);
00061 ix = hx&0x7fffffff;
00062
if ((ix|((lx|(-lx))>>31))>0x3ff00000)
00063
return (x-x)/(x-x);
00064
if(ix==0x3ff00000)
00065
return x/
zero;
00066
if(ix<0x3e300000&&(huge+x)>
zero)
return x;
00067
SET_HIGH_WORD(x,ix);
00068
if(ix<0x3fe00000) {
00069 t = x+x;
00070 t = 0.5*
log1p(t+t*x/(
one-x));
00071 }
else
00072 t = 0.5*
log1p((x+x)/(
one-x));
00073
if(hx>=0)
return t;
else return -t;
00074 }