/* acoshl.c
*
* Inverse hyperbolic cosine , long double precision
*
*
*
* SYNOPSIS :
*
* long double x , y , acoshl ( ) ;
*
* y = acoshl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns inverse hyperbolic cosine of argument .
*
* If 1 < = x < 1 . 5 , a rational approximation
*
* sqrt ( 2 z ) * P ( z ) / Q ( z )
*
* where z = x - 1 , is used . Otherwise ,
*
* acosh ( x ) = log ( x + sqrt ( ( x - 1 ) ( x + 1 ) ) .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE 1 , 3 30000 2 . 0 e - 19 3 . 9 e - 20
*
*
* ERROR MESSAGES :
*
* message condition value returned
* acoshl domain | x | < 1 0 . 0
*
*/
/* acosh.c */
/*
Cephes Math Library Release 2 . 7 : May , 1998
Copyright 1984 , 1991 , 1998 by Stephen L . Moshier
*/
/* acosh(1+x) = sqrt(2x) * R(x), interval 0 < x < 0.5 */
#include "mconf.h"
#ifdef UNK
static long double P[] = {
2 .9071989653343333587238 E-5 L,
3 .2906030801088967279449 E-3 L,
6 .3034445964862182128388 E-2 L,
4 .1587081802731351459504 E-1 L,
1 .0989714347599256302467 E0L,
9 .9999999999999999999715 E-1 L,
};
static long double Q[] = {
1 .0443462486787584738322 E-4 L,
6 .0085845375571145826908 E-3 L,
8 .7750439986662958343370 E-2 L,
4 .9564621536841869854584 E-1 L,
1 .1823047680932589605190 E0L,
1 .0000000000000000000028 E0L,
};
#endif
#ifdef IBMPC
static unsigned short P[] = {
0 x4536,0 x4dba,0 x9f55,0 xf3df,0 x3fef, XPD
0 x23a5,0 xf9aa,0 x289c,0 xd7a7,0 x3ff6, XPD
0 x7e8b,0 x8645,0 x341f,0 x8118,0 x3ffb, XPD
0 x0fd5,0 x937f,0 x0515,0 xd4ed,0 x3ffd, XPD
0 x2364,0 xc41b,0 x1891,0 x8cab,0 x3fff, XPD
0 x0000,0 x0000,0 x0000,0 x8000,0 x3fff, XPD
};
static short Q[] = {
0 x1e7c,0 x4f16,0 xe98c,0 xdb03,0 x3ff1, XPD
0 xc319,0 xc272,0 xa90a,0 xc4e3,0 x3ff7, XPD
0 x2f83,0 x9e5e,0 x80af,0 xb3b6,0 x3ffb, XPD
0 xe1e0,0 xc97c,0 x573a,0 xfdc5,0 x3ffd, XPD
0 xcdf2,0 x6ec5,0 xc33c,0 x9755,0 x3fff, XPD
0 x0000,0 x0000,0 x0000,0 x8000,0 x3fff, XPD
};
#endif
#ifdef MIEEE
static long P[] = {
0 x3fef0000,0 xf3df9f55,0 x4dba4536,
0 x3ff60000,0 xd7a7289c,0 xf9aa23a5,
0 x3ffb0000,0 x8118341f,0 x86457e8b,
0 x3ffd0000,0 xd4ed0515,0 x937f0fd5,
0 x3fff0000,0 x8cab1891,0 xc41b2364,
0 x3fff0000,0 x80000000,0 x00000000,
};
static long Q[] = {
0 x3ff10000,0 xdb03e98c,0 x4f161e7c,
0 x3ff70000,0 xc4e3a90a,0 xc272c319,
0 x3ffb0000,0 xb3b680af,0 x9e5e2f83,
0 x3ffd0000,0 xfdc5573a,0 xc97ce1e0,
0 x3fff0000,0 x9755c33c,0 x6ec5cdf2,
0 x3fff0000,0 x80000000,0 x00000000,
};
#endif
extern long double LOGE2L;
#ifdef INFINITIES
extern long double INFINITYL;
#endif
#ifdef NANS
extern long double NANL;
#endif
#ifdef ANSIPROT
extern long double logl ( long double );
extern long double sqrtl ( long double );
extern long double polevll ( long double , void *, int );
extern int isnanl ( long double );
#else
long double logl(), sqrtl(), polevll(), isnanl();
#endif
long double acoshl(x)
long double x;
{
long double a, z;
#ifdef NANS
if ( isnanl(x) )
return (x);
#endif
if ( x < 1 .0 L )
{
mtherr( "acoshl" , DOMAIN );
#ifdef NANS
return (NANL);
#else
return (0 .0 L);
#endif
}
if ( x > 1 .0 e10 )
{
#ifdef INFINITIES
if ( x == INFINITYL )
return ( INFINITYL );
#endif
return ( logl(x) + LOGE2L );
}
z = x - 1 .0 L;
if ( z < 0 .5 L )
{
a = sqrtl(2 .0 L*z) * (polevll(z, P, 5 ) / polevll(z, Q, 5 ) );
return ( a );
}
a = sqrtl( z*(x+1 .0 L) );
return ( logl(x + a) );
}
Messung V0.5 in Prozent C=98 H=100 G=98
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-13)
¤
*© Formatika GbR, Deutschland