/* acosh.c
*
* Inverse hyperbolic cosine
*
*
*
* SYNOPSIS :
*
* double x , y , acosh ( ) ;
*
* y = acosh ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns inverse hyperbolic cosine of argument .
*
* If 1 < = x < 1 . 5 , a rational approximation
*
* sqrt ( 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
* DEC 1 , 3 30000 4 . 2 e - 17 1 . 1 e - 17
* IEEE 1 , 3 30000 4 . 6 e - 16 8 . 7 e - 17
*
*
* ERROR MESSAGES :
*
* message condition value returned
* acosh domain | x | < 1 NAN
*
*/
/* acosh.c */
/*
Cephes Math Library Release 2 . 8 : June , 2000
Copyright 1984 , 1995 , 2000 by Stephen L . Moshier
*/
/* acosh(z) = sqrt(x) * R(x), z = x + 1, interval 0 < x < 0.5 */
#include "mconf.h"
#ifdef UNK
static double P[] = {
1 .18801130533544501356 E2,
3 .94726656571334401102 E3,
3 .43989375926195455866 E4,
1 .08102874834699867335 E5,
1 .10855947270161294369 E5
};
static double Q[] = {
/* 1.00000000000000000000E0,*/
1 .86145380837903397292 E2,
4 .15352677227719831579 E3,
2 .97683430363289370382 E4,
8 .29725251988426222434 E4,
7 .83869920495893927727 E4
};
#endif
#ifdef DEC
static unsigned short P[] = {
0041755 ,0115055 ,0144002 ,0146444 ,
0043166 ,0132103 ,0155150 ,0150302 ,
0044006 ,0057360 ,0003021 ,0162753 ,
0044323 ,0021557 ,0175225 ,0056253 ,
0044330 ,0101771 ,0040046 ,0006636
};
static unsigned short Q[] = {
/*0040200,0000000,0000000,0000000,*/
0042072 ,0022467 ,0126670 ,0041232 ,
0043201 ,0146066 ,0152142 ,0034015 ,
0043750 ,0110257 ,0121165 ,0026100 ,
0044242 ,0007103 ,0034667 ,0033173 ,
0044231 ,0014576 ,0175573 ,0017472
};
#endif
#ifdef IBMPC
static unsigned short P[] = {
0 x59a4,0 xb900,0 xb345,0 x405d,
0 x1a18,0 x7b4d,0 xd688,0 x40ae,
0 x3cbd,0 x00c2,0 xcbde,0 x40e0,
0 xab95,0 xff52,0 x646d,0 x40fa,
0 xc1b4,0 x2804,0 x107f,0 x40fb
};
static unsigned short Q[] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 x0853,0 xf5b7,0 x44a6,0 x4067,
0 x4702,0 xda8c,0 x3986,0 x40b0,
0 xa588,0 xf44e,0 x1215,0 x40dd,
0 xe6cf,0 x6736,0 x41c8,0 x40f4,
0 x63e7,0 xdf6f,0 x232f,0 x40f3
};
#endif
#ifdef MIEEE
static unsigned short P[] = {
0 x405d,0 xb345,0 xb900,0 x59a4,
0 x40ae,0 xd688,0 x7b4d,0 x1a18,
0 x40e0,0 xcbde,0 x00c2,0 x3cbd,
0 x40fa,0 x646d,0 xff52,0 xab95,
0 x40fb,0 x107f,0 x2804,0 xc1b4
};
static unsigned short Q[] = {
0 x4067,0 x44a6,0 xf5b7,0 x0853,
0 x40b0,0 x3986,0 xda8c,0 x4702,
0 x40dd,0 x1215,0 xf44e,0 xa588,
0 x40f4,0 x41c8,0 x6736,0 xe6cf,
0 x40f3,0 x232f,0 xdf6f,0 x63e7,
};
#endif
#ifdef ANSIPROT
extern double polevl ( double , void *, int );
extern double p1evl ( double , void *, int );
extern double log ( double );
extern double sqrt ( double );
#else
double log(), sqrt(), polevl(), p1evl();
#endif
extern double LOGE2, INFINITY, NAN;
double acosh(x)
double x;
{
double a, z;
if ( x < 1 .0 )
{
mtherr( "acosh" , DOMAIN );
return (NAN);
}
if ( x > 1 .0 e8 )
{
#ifdef INFINITIES
if ( x == INFINITY )
return ( INFINITY );
#endif
return ( log(x) + LOGE2 );
}
z = x - 1 .0 ;
if ( z < 0 .5 )
{
a = sqrt(z) * (polevl(z, P, 4 ) / p1evl(z, Q, 5 ) );
return ( a );
}
a = sqrt( z*(x+1 .0 ) );
return ( log(x + a) );
}
Messung V0.5 in Prozent C=96 H=100 G=97
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-17)
¤
*© Formatika GbR, Deutschland