/* ellpkl.c
*
* Complete elliptic integral of the first kind
*
*
*
* SYNOPSIS :
*
* long double m1 , y , ellpkl ( ) ;
*
* y = ellpkl ( 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
* IEEE 0 , 1 10000 1 . 1 e - 19 3 . 3 e - 20
*
* ERROR MESSAGES :
*
* message condition value returned
* ellpkl domain x < 0 , x > 1 0 . 0
*
*/
/* ellpkl.c */
/*
Cephes Math Library , Release 2 . 3 : October , 1995
Copyright 1984 , 1987 , 1995 by Stephen L . Moshier
*/
#include "mconf.h"
#if UNK
static long double P[13 ] = {
1 .247539729154838838628 E-6 L,
2 .149421654232011240659 E-4 L,
2 .265267575136470585139 E-3 L,
6 .723088676584254248821 E-3 L,
8 .092066790639263075808 E-3 L,
5 .664069509748147028621 E-3 L,
4 .579865994050801042865 E-3 L,
5 .797368411662027645234 E-3 L,
8 .767698209432225911803 E-3 L,
1 .493761594388688915057 E-2 L,
3 .088514457872042326871 E-2 L,
9 .657359027999314232753 E-2 L,
1 .386294361119890618992 E0L,
};
static long double Q[12 ] = {
5 .568631677757315398993 E-5 L,
1 .036110372590318802997 E-3 L,
5 .500459122138244213579 E-3 L,
1 .337330436245904844528 E-2 L,
2 .033103735656990487115 E-2 L,
2 .522868345512332304268 E-2 L,
3 .026786461242788135379 E-2 L,
3 .738370118296930305919 E-2 L,
4 .882812208418620146046 E-2 L,
7 .031249999330222751046 E-2 L,
1 .249999999999978263154 E-1 L,
4 .999999999999999999924 E-1 L,
};
static long double C1 = 1 .386294361119890618834 L; /* log(4) */
#endif
#if IBMPC
static short P[] = {
0 xf098,0 xad01,0 x2381,0 xa771,0 x3feb, XPD
0 xd6ed,0 xea22,0 x1922,0 xe162,0 x3ff2, XPD
0 x3733,0 xe2f1,0 xe226,0 x9474,0 x3ff6, XPD
0 x3031,0 x3c9d,0 x5aff,0 xdc4d,0 x3ff7, XPD
0 x9a46,0 x4310,0 x968e,0 x8494,0 x3ff8, XPD
0 xbe4c,0 x3ff2,0 xa8a7,0 xb999,0 x3ff7, XPD
0 xf35c,0 x0eaf,0 xb355,0 x9612,0 x3ff7, XPD
0 xbc56,0 x8fd4,0 xd9dd,0 xbdf7,0 x3ff7, XPD
0 xc01e,0 x867f,0 x6444,0 x8fa6,0 x3ff8, XPD
0 x4ba3,0 x6392,0 xe6fd,0 xf4bc,0 x3ff8, XPD
0 x62c3,0 xbb12,0 xd7bc,0 xfd02,0 x3ff9, XPD
0 x08fe,0 x476c,0 x5fdf,0 xc5c8,0 x3ffb, XPD
0 x79ad,0 xd1cf,0 x17f7,0 xb172,0 x3fff, XPD
};
static short Q[] = {
0 x96a4,0 x8474,0 xba33,0 xe990,0 x3ff0, XPD
0 xe5a7,0 xa50e,0 x1854,0 x87ce,0 x3ff5, XPD
0 x8999,0 x72e3,0 x3205,0 xb43d,0 x3ff7, XPD
0 x3255,0 x13eb,0 xb438,0 xdb1b,0 x3ff8, XPD
0 xb717,0 x497f,0 x4691,0 xa68d,0 x3ff9, XPD
0 x30be,0 x8c6b,0 x624b,0 xceac,0 x3ff9, XPD
0 xa858,0 x2a0d,0 x5014,0 xf7f4,0 x3ff9, XPD
0 x8615,0 xbfa6,0 xa6df,0 x991f,0 x3ffa, XPD
0 x103c,0 xa076,0 xff37,0 xc7ff,0 x3ffa, XPD
0 xf508,0 xc515,0 xffff,0 x8fff,0 x3ffb, XPD
0 x1af5,0 xfffb,0 xffff,0 xffff,0 x3ffb, XPD
0 x0000,0 x0000,0 x0000,0 x8000,0 x3ffe, XPD
};
static unsigned short ac1[] = {
0 x79ac,0 xd1cf,0 x17f7,0 xb172,0 x3fff, XPD
};
#define C1 (*(long double *)ac1)
#endif
#ifdef MIEEE
static long P[39 ] = {
0 x3feb0000,0 xa7712381,0 xad01f098,
0 x3ff20000,0 xe1621922,0 xea22d6ed,
0 x3ff60000,0 x9474e226,0 xe2f13733,
0 x3ff70000,0 xdc4d5aff,0 x3c9d3031,
0 x3ff80000,0 x8494968e,0 x43109a46,
0 x3ff70000,0 xb999a8a7,0 x3ff2be4c,
0 x3ff70000,0 x9612b355,0 x0eaff35c,
0 x3ff70000,0 xbdf7d9dd,0 x8fd4bc56,
0 x3ff80000,0 x8fa66444,0 x867fc01e,
0 x3ff80000,0 xf4bce6fd,0 x63924ba3,
0 x3ff90000,0 xfd02d7bc,0 xbb1262c3,
0 x3ffb0000,0 xc5c85fdf,0 x476c08fe,
0 x3fff0000,0 xb17217f7,0 xd1cf79ad,
};
static long Q[36 ] = {
0 x3ff00000,0 xe990ba33,0 x847496a4,
0 x3ff50000,0 x87ce1854,0 xa50ee5a7,
0 x3ff70000,0 xb43d3205,0 x72e38999,
0 x3ff80000,0 xdb1bb438,0 x13eb3255,
0 x3ff90000,0 xa68d4691,0 x497fb717,
0 x3ff90000,0 xceac624b,0 x8c6b30be,
0 x3ff90000,0 xf7f45014,0 x2a0da858,
0 x3ffa0000,0 x991fa6df,0 xbfa68615,
0 x3ffa0000,0 xc7ffff37,0 xa076103c,
0 x3ffb0000,0 x8fffffff,0 xc515f508,
0 x3ffb0000,0 xffffffff,0 xfffb1af5,
0 x3ffe0000,0 x80000000,0 x00000000,
};
static unsigned long ac1[] = {
0 x3fff0000,0 xb17217f7,0 xd1cf79ac
};
#define C1 (*(long double *)ac1)
#endif
#ifdef ANSIPROT
extern long double polevll ( long double , void *, int );
extern long double logl ( long double );
#else
long double polevll(), logl();
#endif
extern long double MACHEPL, MAXNUML;
long double ellpkl(x)
long double x;
{
if ( (x < 0 .0 L) || (x > 1 .0 L) )
{
mtherr( "ellpkl" , DOMAIN );
return ( 0 .0 L );
}
if ( x > MACHEPL )
{
return ( polevll(x,P,12 ) - logl(x) * polevll(x,Q,11 ) );
}
else
{
if ( x == 0 .0 L )
{
mtherr( "ellpkl" , SING );
return ( MAXNUML );
}
else
{
return ( C1 - 0 .5 L * logl(x) );
}
}
}
Messung V0.5 in Prozent C=99 H=100 G=99
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-14)
¤
*© Formatika GbR, Deutschland