newlib/winsup/mingw/mingwex/math/acoshf.c
Danny Smith 72db1c11e9 * include/math.h (ashinh, asinhf, asinhl, acosh, acoshf, acoshl,
atanh, atanhf, atanhl): Add prototypes.
	* mingwex/Makefile.in (MATH_OBJS): Add objects for above to list.
	(MATH_DISTFILES): Add sources for above and fastmath.h to list.
	Specify dependency on fastmath.h for new objects.
	* mingwex/math/fastmath.h: New file.
	* mingwex/math/ashinh.c: New file.
	* mingwex/math/asinhf.c: New file.
	* mingwex/math/asinhl.c: New file.
	* mingwex/math/acosh.c: New file.
	* mingwex/math/acoshf.c: New file.
	* mingwex/math/acoshl.c: New file.
	* mingwex/math/atanh.c: New file.
	* mingwex/math/atanhf.c: New file.
	* mingwex/math/atanhl.c: New file.
2004-10-06 20:31:32 +00:00

26 lines
671 B
C
Executable File

#include <math.h>
#include <errno.h>
#include "fastmath.h"
/* acosh(x) = log (x + sqrt(x * x - 1)) */
float acoshf (float x)
{
if (isnan (x))
return x;
if (x < 1.0f)
{
errno = EDOM;
return nan("");
}
if (x > 0x1p32f)
/* Avoid overflow (and unnecessary calculation when
sqrt (x * x - 1) == x). GCC optimizes by replacing
the long double M_LN2 const with a fldln2 insn. */
return __fast_log (x) + 6.9314718055994530941723E-1L;
/* Since x >= 1, the arg to log will always be greater than
the fyl2xp1 limit (approx 0.29) so just use logl. */
return __fast_log (x + __fast_sqrt((x + 1.0) * (x - 1.0)));
}