00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
00015 #endif
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "math.h"
00029 #include "mathP.h"
00030
00031 #ifdef __STDC__
00032 static const double
00033 #else
00034 static double
00035 #endif
00036 one = 1.00000000000000000000e+00,
00037 ln2 = 6.93147180559945286227e-01,
00038 huge= 1.00000000000000000000e+300;
00039
00040 #ifdef __STDC__
00041 double asinh(double x)
00042 #else
00043 double asinh(x)
00044 double x;
00045 #endif
00046 {
00047 double t,w;
00048 int32_t hx,ix;
00049 GET_HIGH_WORD(hx,x);
00050 ix = hx&0x7fffffff;
00051 if(ix>=0x7ff00000) return x+x;
00052 if(ix< 0x3e300000) {
00053 if(huge+x>one) return x;
00054 }
00055 if(ix>0x41b00000) {
00056 w = __ieee754_log(fabs(x))+ln2;
00057 } else if (ix>0x40000000) {
00058 t = fabs(x);
00059 w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
00060 } else {
00061 t = x*x;
00062 w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
00063 }
00064 if(hx>0) return w; else return -w;
00065 }