|
Packit |
6c4009 |
/* e_acoshf.c -- float version of e_acosh.c.
|
|
Packit |
6c4009 |
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
Packit |
6c4009 |
*
|
|
Packit |
6c4009 |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
Packit |
6c4009 |
* Permission to use, copy, modify, and distribute this
|
|
Packit |
6c4009 |
* software is freely granted, provided that this notice
|
|
Packit |
6c4009 |
* is preserved.
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined(LIBM_SCCS) && !defined(lint)
|
|
Packit |
6c4009 |
static char rcsid[] = "$NetBSD: e_acoshf.c,v 1.5 1995/05/12 04:57:20 jtc Exp $";
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <math.h>
|
|
Packit |
6c4009 |
#include <math_private.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static const float
|
|
Packit |
6c4009 |
one = 1.0,
|
|
Packit |
6c4009 |
ln2 = 6.9314718246e-01; /* 0x3f317218 */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
float __ieee754_acoshf(float x)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
float t;
|
|
Packit |
6c4009 |
int32_t hx;
|
|
Packit |
6c4009 |
GET_FLOAT_WORD(hx,x);
|
|
Packit |
6c4009 |
if(hx<0x3f800000) { /* x < 1 */
|
|
Packit |
6c4009 |
return (x-x)/(x-x);
|
|
Packit |
6c4009 |
} else if(hx >=0x4d800000) { /* x > 2**28 */
|
|
Packit |
6c4009 |
if(hx >=0x7f800000) { /* x is inf of NaN */
|
|
Packit |
6c4009 |
return x+x;
|
|
Packit |
6c4009 |
} else
|
|
Packit |
6c4009 |
return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */
|
|
Packit |
6c4009 |
} else if (hx==0x3f800000) {
|
|
Packit |
6c4009 |
return 0.0; /* acosh(1) = 0 */
|
|
Packit |
6c4009 |
} else if (hx > 0x40000000) { /* 2**28 > x > 2 */
|
|
Packit |
6c4009 |
t=x*x;
|
|
Packit |
6c4009 |
return __ieee754_logf((float)2.0*x-one/(x+sqrtf(t-one)));
|
|
Packit |
6c4009 |
} else { /* 1
|
|
Packit |
6c4009 |
t = x-one;
|
|
Packit |
6c4009 |
return __log1pf(t+sqrtf((float)2.0*t+t*t));
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
strong_alias (__ieee754_acoshf, __acoshf_finite)
|