/* tanl.c
*
* Circular tangent , long double precision
*
*
*
* SYNOPSIS :
*
* long double x , y , tanl ( ) ;
*
* y = tanl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns the circular tangent of the radian argument x .
*
* Range reduction is modulo pi / 4 . A rational function
* x + x * * 3 P ( x * * 2 ) / Q ( x * * 2 )
* is employed in the basic interval [ 0 , pi / 4 ] .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE + - 1 . 07 e9 30000 1 . 9 e - 19 4 . 8 e - 20
*
* ERROR MESSAGES :
*
* message condition value returned
* tan total loss x > 2 ^ 39 0 . 0
*
*/
/* cotl.c
*
* Circular cotangent , long double precision
*
*
*
* SYNOPSIS :
*
* long double x , y , cotl ( ) ;
*
* y = cotl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns the circular cotangent of the radian argument x .
*
* Range reduction is modulo pi / 4 . A rational function
* x + x * * 3 P ( x * * 2 ) / Q ( x * * 2 )
* is employed in the basic interval [ 0 , pi / 4 ] .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE + - 1 . 07 e9 30000 1 . 9 e - 19 5 . 1 e - 20
*
*
* ERROR MESSAGES :
*
* message condition value returned
* cot total loss x > 2 ^ 39 0 . 0
* cot singularity x = 0 INFINITYL
*
*/
/*
Cephes Math Library Release 2 . 7 : May , 1998
Copyright 1984 , 1990 , 1998 by Stephen L . Moshier
*/
#include "mconf.h"
#ifdef UNK
static long double P[] = {
-1 .3093693918138377764608 E4L,
1 .1535166483858741613983 E6L,
-1 .7956525197648487798769 E7L,
};
static long double Q[] = {
/* 1.0000000000000000000000E0L,*/
1 .3681296347069295467845 E4L,
-1 .3208923444021096744731 E6L,
2 .5008380182335791583922 E7L,
-5 .3869575592945462988123 E7L,
};
static long double DP1 = 7 .853981554508209228515625 E-1 L;
static long double DP2 = 7 .946627356147928367136046290398 E-9 L;
static long double DP3 = 3 .061616997868382943065164830688 E-17 L;
#endif
#ifdef IBMPC
static short P[] = {
0 xbc1c,0 x79f9,0 xc692,0 xcc96,0 xc00c, XPD
0 xe5b1,0 xe4ee,0 x652f,0 x8ccf,0 x4013, XPD
0 xaf9a,0 x4c8b,0 x5699,0 x88ff,0 xc017, XPD
};
static short Q[] = {
/*0x0000,0x0000,0x0000,0x8000,0x3fff,*/
0 x8ed4,0 x9b2b,0 x2f75,0 xd5c5,0 x400c, XPD
0 xadcd,0 x55e4,0 xe2c1,0 xa13d,0 xc013, XPD
0 x7adf,0 x56c7,0 x7e17,0 xbecc,0 x4017, XPD
0 x86f6,0 xf2d1,0 x01e5,0 xcd7f,0 xc018, XPD
};
static short P1[] = {0 x0000,0 x0000,0 xda80,0 xc90f,0 x3ffe, XPD};
static short P2[] = {0 x0000,0 x0000,0 xa300,0 x8885,0 x3fe4, XPD};
static short P3[] = {0 x3707,0 xa2e0,0 x3198,0 x8d31,0 x3fc8, XPD};
#define DP1 *(long double *)P1
#define DP2 *(long double *)P2
#define DP3 *(long double *)P3
#endif
#ifdef MIEEE
static long P[] = {
0 xc00c0000,0 xcc96c692,0 x79f9bc1c,
0 x40130000,0 x8ccf652f,0 xe4eee5b1,
0 xc0170000,0 x88ff5699,0 x4c8baf9a,
};
static long Q[] = {
/*0x3fff0000,0x80000000,0x00000000,*/
0 x400c0000,0 xd5c52f75,0 x9b2b8ed4,
0 xc0130000,0 xa13de2c1,0 x55e4adcd,
0 x40170000,0 xbecc7e17,0 x56c77adf,
0 xc0180000,0 xcd7f01e5,0 xf2d186f6,
};
static long P1[] = {0 x3ffe0000,0 xc90fda80,0 x00000000};
static long P2[] = {0 x3fe40000,0 x8885a300,0 x00000000};
static long P3[] = {0 x3fc80000,0 x8d313198,0 xa2e03707};
#define DP1 *(long double *)P1
#define DP2 *(long double *)P2
#define DP3 *(long double *)P3
#endif
static long double lossth = 5 .49755813888 e11L; /* 2^39 */
extern long double PIO4L;
extern long double MAXNUML;
#ifdef ANSIPROT
extern long double polevll ( long double , void *, int );
extern long double p1evll ( long double , void *, int );
extern long double floorl ( long double );
extern long double ldexpl ( long double , int );
extern int isnanl ( long double );
extern int isfinitel ( long double );
static long double tancotl( long double , int );
#else
long double polevll(), p1evll(), floorl(), ldexpl(), isnanl(), isfinitel();
static long double tancotl();
#endif
#ifdef INFINITIES
extern long double INFINITYL;
#endif
#ifdef NANS
extern long double NANL;
#endif
long double tanl(x)
long double x;
{
#ifdef NANS
if ( isnanl(x) )
return (x);
#endif
#ifdef MINUSZERO
if ( x == 0 .0 L )
return (x);
#endif
#ifdef NANS
if ( !isfinitel(x) )
{
mtherr( "tanl" , DOMAIN );
return (NANL);
}
#endif
return ( tancotl(x,0 ) );
}
long double cotl(x)
long double x;
{
if ( x == 0 .0 L )
{
mtherr( "cotl" , SING );
#ifdef INFINITIES
return ( INFINITYL );
#else
return ( MAXNUML );
#endif
}
return ( tancotl(x,1 ) );
}
static long double tancotl( xx, cotflg )
long double xx;
int cotflg;
{
long double x, y, z, zz;
int j, sign;
/* make argument positive but save the sign */
if ( xx < 0 .0 L )
{
x = -xx;
sign = -1 ;
}
else
{
x = xx;
sign = 1 ;
}
if ( x > lossth )
{
if ( cotflg )
mtherr( "cotl" , TLOSS );
else
mtherr( "tanl" , TLOSS );
return (0 .0 L);
}
/* compute x mod PIO4 */
y = floorl( x/PIO4L );
/* strip high bits of integer part */
z = ldexpl( y, -4 );
z = floorl(z); /* integer part of y/16 */
z = y - ldexpl( z, 4 ); /* y - 16 * (y/16) */
/* integer and fractional part modulo one octant */
j = z;
/* map zeros and singularities to origin */
if ( j & 1 )
{
j += 1 ;
y += 1 .0 L;
}
z = ((x - y * DP1) - y * DP2) - y * DP3;
zz = z * z;
if ( zz > 1 .0 e-20 L )
y = z + z * (zz * polevll( zz, P, 2 )/p1evll(zz, Q, 4 ));
else
y = z;
if ( j & 2 )
{
if ( cotflg )
y = -y;
else
y = -1 .0 L/y;
}
else
{
if ( cotflg )
y = 1 .0 L/y;
}
if ( sign < 0 )
y = -y;
return ( y );
}
Messung V0.5 in Prozent C=96 H=100 G=97
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-13)
¤
*© Formatika GbR, Deutschland