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  atanh.c

  Sprache: C
 

/* atanh.c
 *
 * Inverse hyperbolic tangent
 *
 *
 *
 * SYNOPSIS:
 *
 * double x, y, atanh();
 *
 * y = atanh( x );
 *
 *
 *
 * DESCRIPTION:
 *
 * Returns inverse hyperbolic tangent of argument in the range
 * MINLOG to MAXLOG.
 *
 * If |x| < 0.5, the rational form x + x**3 P(x)/Q(x) is
 * employed.  Otherwise,
 *        atanh(x) = 0.5 * log( (1+x)/(1-x) ).
 *
 *
 *
 * ACCURACY:
 *
 *                      Relative error:
 * arithmetic   domain     # trials      peak         rms
 *    DEC       -1,1        50000       2.4e-17     6.4e-18
 *    IEEE      -1,1        30000       1.9e-16     5.2e-17
 *
 */


/* atanh.c */

/*
Cephes Math Library Release 2.8:  June, 2000
Copyright (C) 1987, 1995, 2000 by Stephen L. Moshier
*/


#include "mconf.h"

#ifdef UNK
static double P[] = {-8.54074331929669305196E-11.20426861384072379242E1,
                     -4.61252884198732692637E1, 6.54566728676544377376E1,
                     -3.09092539379866942570E1};
static double Q[] = {
    /* 1.00000000000000000000E0,*/
    -1.95638849376911654834E1, 1.08938092147140262656E2,
    -2.49839401325893582852E2, 2.52006675691344555838E2,
    -9.27277618139601130017E1};
#endif
#ifdef DEC
static unsigned short P[] = {01401320122235010577501303000041100,
                             01273270124407003472201414700100113,
                             01156070130535004160201647210003257,
                             00136730141367004304601666730045750};
static unsigned short Q[] = {
    /*0040200,0000000,0000000,0000000,*/
    0141234010132600154600134564004173101601150116451,
    0032045014217101533430000532016722600421740000665,
    007760400003100141671007223500311140074377};
#endif

#ifdef IBMPC
static unsigned short P[] = {0xb618, 0xb17f, 0x5493, 0xbfeb, 0xe73a,
                             0xf520, 0x15da, 0x4028, 0xf62c, 0x7370,
                             0x1009, 0xc047, 0xe2f7, 0x20d5, 0x5d3a,
                             0x4050, 0x697d, 0xddb7, 0xe8c4, 0xc03e};
static unsigned short Q[] = {
    /*0x0000,0x0000,0x0000,0x3ff0,*/
    0x172f, 0xc366, 0x905a, 0xc033, 0x2685, 0xb3a5, 0x3c09,
    0x405b, 0x5dd3, 0x602b, 0x3adc, 0xc06f, 0x8019, 0xaff0,
    0x8036, 0x406f, 0x8f20, 0xa649, 0x2e93, 0xc057};
#endif

#ifdef MIEEE
static unsigned short P[] = {0xbfeb, 0x5493, 0xb17f, 0xb618, 0x4028,
                             0x15da, 0xf520, 0xe73a, 0xc047, 0x1009,
                             0x7370, 0xf62c, 0x4050, 0x5d3a, 0x20d5,
                             0xe2f7, 0xc03e, 0xe8c4, 0xddb7, 0x697d};
static unsigned short Q[] = {0xc033, 0x905a, 0xc366, 0x172f, 0x405b,
                             0x3c09, 0xb3a5, 0x2685, 0xc06f, 0x3adc,
                             0x602b, 0x5dd3, 0x406f, 0x8036, 0xaff0,
                             0x8019, 0xc057, 0x2e93, 0xa649, 0x8f20};
#endif

#ifdef ANSIPROT
extern double fabs(double);
extern double log(double x);
extern double polevl(double x, void *P, int N);
extern double p1evl(double x, void *P, int N);
#else
double fabs(), log(), polevl(), p1evl();
#endif
extern double INFINITY, NAN;

double atanh(x) double x;
{
  double s, z;

#ifdef MINUSZERO
  if (x == 0.0)
    return (x);
#endif
  z = fabs(x);
  if (z >= 1.0) {
    if (x == 1.0)
      return (INFINITY);
    if (x == -1.0)
      return (-INFINITY);
    mtherr("atanh", DOMAIN);
    return (NAN);
  }

  if (z < 1.0e-7)
    return (x);

  if (z < 0.5) {
    z = x * x;
    s = x + x * z * (polevl(z, P, 4) / p1evl(z, Q, 5));
    return (s);
  }

  return (0.5 * log((1.0 + x) / (1.0 - x)));
}

Messung V0.5 in Prozent
C=95 H=90 G=92

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© 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.