#include <sys/cdefs.h>
#if defined(LIBM_SCCS) && !defined(lint)
__RCSID("$NetBSD: e_acoshf.c,v 1.8 2002/05/26 22:01:48 wiz Exp $");
#endif
#include "math.h"
#include "math_private.h"
static const float
one = 1.0,
ln2 = 6.9314718246e-01;
float
__ieee754_acoshf(float x)
{
float t;
int32_t hx;
GET_FLOAT_WORD(hx,x);
if(hx<0x3f800000) {
return (x-x)/(x-x);
} else if(hx >=0x4d800000) {
if(hx >=0x7f800000) {
return x+x;
} else
return __ieee754_logf(x)+ln2;
} else if (hx==0x3f800000) {
return 0.0;
} else if (hx > 0x40000000) {
t=x*x;
return __ieee754_logf((float)2.0*x-one/(x+__ieee754_sqrtf(t-one)));
} else {
t = x-one;
return log1pf(t+sqrtf((float)2.0*t+t*t));
}
}