Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Cephes/   (Cephes Mathematical Library ©)  Datei vom 9.5.2026 mit Größe 3 kB image not shown  

Quelle  acosh.c

  Sprache: C
 

/* 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.2e-17     1.1e-17
 *    IEEE      1,3         30000       4.6e-16     8.7e-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.18801130533544501356E2, 3.94726656571334401102E3,
                     3.43989375926195455866E4, 1.08102874834699867335E5,
                     1.10855947270161294369E5};
static double Q[] = {
    /* 1.00000000000000000000E0,*/
    1.86145380837903397292E2, 4.15352677227719831579E3,
    2.97683430363289370382E4, 8.29725251988426222434E4,
    7.83869920495893927727E4};
#endif

#ifdef DEC
static unsigned short P[] = {00417550115055014400201464440043166,
                             01321030155150015030200440060057360,
                             00030210162753004432300215570175225,
                             00562530044330010177100400460006636};
static unsigned short Q[] = {
    /*0040200,0000000,0000000,0000000,*/
    0042072002246701266700041232004320101460660152142,
    0034015004375001102570121165002610000442420007103,
    003466700331730044231001457601755730017472};
#endif

#ifdef IBMPC
static unsigned short P[] = {0x59a4, 0xb900, 0xb345, 0x405d, 0x1a18,
                             0x7b4d, 0xd688, 0x40ae, 0x3cbd, 0x00c2,
                             0xcbde, 0x40e0, 0xab95, 0xff52, 0x646d,
                             0x40fa, 0xc1b4, 0x2804, 0x107f, 0x40fb};
static unsigned short Q[] = {
    /*0x0000,0x0000,0x0000,0x3ff0,*/
    0x0853, 0xf5b7, 0x44a6, 0x4067, 0x4702, 0xda8c, 0x3986,
    0x40b0, 0xa588, 0xf44e, 0x1215, 0x40dd, 0xe6cf, 0x6736,
    0x41c8, 0x40f4, 0x63e7, 0xdf6f, 0x232f, 0x40f3};
#endif

#ifdef MIEEE
static unsigned short P[] = {0x405d, 0xb345, 0xb900, 0x59a4, 0x40ae,
                             0xd688, 0x7b4d, 0x1a18, 0x40e0, 0xcbde,
                             0x00c2, 0x3cbd, 0x40fa, 0x646d, 0xff52,
                             0xab95, 0x40fb, 0x107f, 0x2804, 0xc1b4};
static unsigned short Q[] = {
    0x4067, 0x44a6, 0xf5b7, 0x0853, 0x40b0, 0x3986, 0xda8c,
    0x4702, 0x40dd, 0x1215, 0xf44e, 0xa588, 0x40f4, 0x41c8,
    0x6736, 0xe6cf, 0x40f3, 0x232f, 0xdf6f, 0x63e7,
};
#endif

#ifdef ANSIPROT
extern double polevl(doublevoid *, int);
extern double p1evl(doublevoid *, 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.0e8) {
#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=94 H=79 G=86

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-09) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.