Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Cephes/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 9.5.2026 mit Größe 5 kB image not shown  

Quellcode-Bibliothek ellpk.c

  Sprache: C
 

/* ellpk.c
 *
 * Complete elliptic integral of the first kind
 *
 *
 *
 * SYNOPSIS:
 *
 * double m1, y, ellpk();
 *
 * y = ellpk( m1 );
 *
 *
 *
 * DESCRIPTION:
 *
 * Approximates the integral
 *
 *
 *
 *            pi/2
 *             -
 *            | |
 *            |           dt
 * K(m)  =    |    ------------------
 *            |                   2
 *          | |    sqrt( 1 - m sin t )
 *           -
 *            0
 *
 * where m = 1 - m1, using the approximation
 *
 *     P(x)  -  log x Q(x).
 *
 * The argument m1 is used rather than m so that the logarithmic
 * singularity at m = 1 will be shifted to the origin; this
 * preserves maximum accuracy.
 *
 * K(0) = pi/2.
 *
 * ACCURACY:
 *
 *                      Relative error:
 * arithmetic   domain     # trials      peak         rms
 *    DEC        0,1        16000       3.5e-17     1.1e-17
 *    IEEE       0,1        30000       2.5e-16     6.8e-17
 *
 * ERROR MESSAGES:
 *
 *   message         condition      value returned
 * ellpk domain       x<0, x>1           0.0
 *
 */


/* ellpk.c */

/*
Cephes Math Library, Release 2.8:  June, 2000
Copyright 1984, 1987, 2000 by Stephen L. Moshier
*/


#include "mconf.h"

#ifdef DEC
static unsigned short P[] = {
    00350200127576004043000515440036025007013600427030153716,
    00364020122614006255500777770036441010213000723340025172,
    00363410043320011724201720760036312014645600772420154141,
    00364200003467001372700354070036564013726301106510020237,
    00367750001330014405600203050037305014413701575210141734,
    0040261007102701737210147572};
static unsigned short Q[] = {
    00343660130371010345300776330035557012274501735150113016,
    00363020124470016730400744730036575013240301172260117576,
    00367030156271004712401477330036766013746500020530157312,
    00370310014423015427401765150037107017774701432160016145,
    00372170177777017262100740000037377017777701777760156435,
    0040000000000000000000000000};
static unsigned short ac1[] = {0040261007102701737210147572};
#define C1 (*(double *)ac1)
#endif

#ifdef IBMPC
static unsigned short P[] = {
    0x0a6d, 0xc823, 0x15ef, 0x3f22, 0x7afa, 0xc8b8, 0xae0b, 0x3f62, 0xb000,
    0x8cad, 0x54b1, 0x3f80, 0x854f, 0x0e9b, 0x308b, 0x3f84, 0x5e88, 0x13d4,
    0x28da, 0x3f7c, 0x5b0c, 0xcfd4, 0x59a5, 0x3f79, 0xe761, 0xe2fa, 0x00e6,
    0x3f82, 0x2414, 0x7235, 0x97d6, 0x3f8e, 0xc419, 0x1905, 0xa05b, 0x3f9f,
    0x387c, 0xfbea, 0xb90b, 0x3fb8, 0x39ef, 0xfefa, 0x2e42, 0x3ff6};
static unsigned short Q[] = {
    0x6ff3, 0x30e5, 0xd61f, 0x3efe, 0xb2c2, 0xbee9, 0xf4bc, 0x3f4d, 0x8f27,
    0x1dd8, 0x5527, 0x3f78, 0xd3f0, 0x73d2, 0xb6a0, 0x3f8f, 0x99fb, 0x29ca,
    0x7b97, 0x3f98, 0x7bd9, 0xa085, 0xd7e6, 0x3f9e, 0x9faa, 0x7b17, 0x2322,
    0x3fa3, 0xc38d, 0xf8d1, 0xfffc, 0x3fa8, 0x2f00, 0xfeb2, 0xffff, 0x3fb1,
    0xdba4, 0xffff, 0xffff, 0x3fbf, 0x0000, 0x0000, 0x0000, 0x3fe0};
static unsigned short ac1[] = {0x39ef, 0xfefa, 0x2e42, 0x3ff6};
#define C1 (*(double *)ac1)
#endif

#ifdef MIEEE
static unsigned short P[] = {
    0x3f22, 0x15ef, 0xc823, 0x0a6d, 0x3f62, 0xae0b, 0xc8b8, 0x7afa, 0x3f80,
    0x54b1, 0x8cad, 0xb000, 0x3f84, 0x308b, 0x0e9b, 0x854f, 0x3f7c, 0x28da,
    0x13d4, 0x5e88, 0x3f79, 0x59a5, 0xcfd4, 0x5b0c, 0x3f82, 0x00e6, 0xe2fa,
    0xe761, 0x3f8e, 0x97d6, 0x7235, 0x2414, 0x3f9f, 0xa05b, 0x1905, 0xc419,
    0x3fb8, 0xb90b, 0xfbea, 0x387c, 0x3ff6, 0x2e42, 0xfefa, 0x39ef};
static unsigned short Q[] = {
    0x3efe, 0xd61f, 0x30e5, 0x6ff3, 0x3f4d, 0xf4bc, 0xbee9, 0xb2c2, 0x3f78,
    0x5527, 0x1dd8, 0x8f27, 0x3f8f, 0xb6a0, 0x73d2, 0xd3f0, 0x3f98, 0x7b97,
    0x29ca, 0x99fb, 0x3f9e, 0xd7e6, 0xa085, 0x7bd9, 0x3fa3, 0x2322, 0x7b17,
    0x9faa, 0x3fa8, 0xfffc, 0xf8d1, 0xc38d, 0x3fb1, 0xffff, 0xfeb2, 0x2f00,
    0x3fbf, 0xffff, 0xffff, 0xdba4, 0x3fe0, 0x0000, 0x0000, 0x0000};
static unsigned short ac1[] = {0x3ff6, 0x2e42, 0xfefa, 0x39ef};
#define C1 (*(double *)ac1)
#endif

#ifdef UNK
static double P[] = {1.37982864606273237150E-42.28025724005875567385E-3,
                     7.97404013220415179367E-39.85821379021226008714E-3,
                     6.87489687449949877925E-36.18901033637687613229E-3,
                     8.79078273952743772254E-31.49380448916805252718E-2,
                     3.08851465246711995998E-29.65735902811690126535E-2,
                     1.38629436111989062502E0};

static double Q[] = {2.94078955048598507511E-59.14184723865917226571E-4,
                     5.94058303753167793257E-31.54850516649762399335E-2,
                     2.39089602715924892727E-23.01204715227604046988E-2,
                     3.73774314173823228969E-24.88280347570998239232E-2,
                     7.03124996963957469739E-21.24999999999870820058E-1,
                     4.99999999999999999821E-1};
static double C1 = 1.3862943611198906188E0; /* log(4) */
#endif

#ifdef ANSIPROT
extern double polevl(doublevoid *, int);
extern double p1evl(doublevoid *, int);
extern double log(double);
#else
double polevl(), p1evl(), log();
#endif
extern double MACHEP, MAXNUM;

double ellpk(x) double x;
{

  if ((x < 0.0) || (x > 1.0)) {
    mtherr("ellpk", DOMAIN);
    return (0.0);
  }

  if (x > MACHEP) {
    return (polevl(x, P, 10) - log(x) * polevl(x, Q, 10));
  } else {
    if (x == 0.0) {
      mtherr("ellpk", SING);
      return (MAXNUM);
    } else {
      return (C1 - 0.5 * log(x));
    }
  }
}

Messung V0.5 in Prozent
C=94 H=94 G=93

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-06-10) ¤

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