/* atanl.c
*
* Inverse circular tangent , long double precision
* ( arctangent )
*
*
*
* SYNOPSIS :
*
* long double x , y , atanl ( ) ;
*
* y = atanl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns radian angle between - pi / 2 and + pi / 2 whose tangent
* is x .
*
* Range reduction is from four intervals into the interval
* from zero to tan ( pi / 8 ) . The approximant uses a rational
* function of degree 3 / 4 of the form x + x * * 3 P ( x ) / Q ( x ) .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE - 10 , 10 150000 1 . 3 e - 19 3 . 0 e - 20
*
*/
/* atan2l()
*
* Quadrant correct inverse circular tangent ,
* long double precision
*
*
*
* SYNOPSIS :
*
* long double x , y , z , atan2l ( ) ;
*
* z = atan2l ( y , x ) ;
*
*
*
* DESCRIPTION :
*
* Returns radian angle whose tangent is y / x .
* Define compile time symbol ANSIC = 1 for ANSI standard ,
* range - PI < z < = + PI , args ( y , x ) ; else ANSIC = 0 for range
* 0 to 2 PI , args ( x , y ) .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE - 10 , 10 60000 1 . 7 e - 19 3 . 2 e - 20
* See atan . c .
*
*/
/* atan.c */
/*
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[] = {
-8 .6863818178092187535440 E-1 L,
-1 .4683508633175792446076 E1L,
-6 .3976888655834347413154 E1L,
-9 .9988763777265819915721 E1L,
-5 .0894116899623603312185 E1L,
};
static long double Q[] = {
/* 1.00000000000000000000E0L,*/
2 .2981886733594175366172 E1L,
1 .4399096122250781605352 E2L,
3 .6144079386152023162701 E2L,
3 .9157570175111990631099 E2L,
1 .5268235069887081006606 E2L,
};
/* tan( 3*pi/8 ) */
static long double T3P8 = 2 .41421356237309504880169 L;
/* tan( pi/8 ) */
static long double TP8 = 4 .1421356237309504880169 e-1 L;
#endif
#ifdef IBMPC
static unsigned short P[] = {
0 x8ece,0 xce53,0 x1266,0 xde5f,0 xbffe, XPD
0 x07e6,0 xa061,0 xa6bf,0 xeaef,0 xc002, XPD
0 x53ee,0 xf291,0 x557f,0 xffe8,0 xc004, XPD
0 xf9d6,0 xeda6,0 x3f3e,0 xc7fa,0 xc005, XPD
0 xb6c3,0 x6abc,0 x9361,0 xcb93,0 xc004, XPD
};
static unsigned short Q[] = {
/*0x0000,0x0000,0x0000,0x8000,0x3fff,*/
0 x54d4,0 x894e,0 xe76e,0 xb7da,0 x4003, XPD
0 x76b9,0 x7a46,0 xafa2,0 x8ffd,0 x4006, XPD
0 xe3a9,0 xe9c0,0 x6bee,0 xb4b8,0 x4007, XPD
0 xabc1,0 x50a7,0 xb098,0 xc3c9,0 x4007, XPD
0 x891c,0 x100d,0 xae89,0 x98ae,0 x4006, XPD
};
/* tan( 3*pi/8 ) = 2.41421356237309504880 */
static unsigned short T3P8A[] = {0 x3242,0 xfcef,0 x7999,0 x9a82,0 x4000, XPD};
#define T3P8 *(long double *)T3P8A
/* tan( pi/8 ) = 0.41421356237309504880 */
static unsigned short TP8A[] = {0 x9211,0 xe779,0 xcccf,0 xd413,0 x3ffd, XPD};
#define TP8 *(long double *)TP8A
#endif
#ifdef MIEEE
static unsigned long P[] = {
0 xbffe0000,0 xde5f1266,0 xce538ece,
0 xc0020000,0 xeaefa6bf,0 xa06107e6,
0 xc0040000,0 xffe8557f,0 xf29153ee,
0 xc0050000,0 xc7fa3f3e,0 xeda6f9d6,
0 xc0040000,0 xcb939361,0 x6abcb6c3,
};
static unsigned long Q[] = {
/*0x3fff0000,0x80000000,0x00000000,*/
0 x40030000,0 xb7dae76e,0 x894e54d4,
0 x40060000,0 x8ffdafa2,0 x7a4676b9,
0 x40070000,0 xb4b86bee,0 xe9c0e3a9,
0 x40070000,0 xc3c9b098,0 x50a7abc1,
0 x40060000,0 x98aeae89,0 x100d891c,
};
/* tan( 3*pi/8 ) = 2.41421356237309504880 */
static long T3P8A[] = {0 x40000000,0 x9a827999,0 xfcef3242};
#define T3P8 *(long double *)T3P8A
/* tan( pi/8 ) = 0.41421356237309504880 */
static long TP8A[] = {0 x3ffd0000,0 xd413cccf,0 xe7799211};
#define TP8 *(long double *)TP8A
#endif
#ifdef ANSIPROT
extern long double polevll ( long double , void *, int );
extern long double p1evll ( long double , void *, int );
extern long double fabsl ( long double );
extern int signbitl ( long double );
extern int isnanl ( long double );
long double atanl ( long double );
#else
long double polevll(), p1evll(), fabsl(), signbitl(), isnanl();
long double atanl();
#endif
#ifdef INFINITIES
extern long double INFINITYL;
#endif
#ifdef NANS
extern long double NANL;
#endif
#ifdef MINUSZERO
extern long double NEGZEROL;
#endif
long double atanl(x)
long double x;
{
extern long double PIO2L, PIO4L;
long double y, z;
short sign;
#ifdef MINUSZERO
if ( x == 0 .0 L )
return (x);
#endif
#ifdef INFINITIES
if ( x == INFINITYL )
return ( PIO2L );
if ( x == -INFINITYL )
return ( -PIO2L );
#endif
/* make argument positive and save the sign */
sign = 1 ;
if ( x < 0 .0 L )
{
sign = -1 ;
x = -x;
}
/* range reduction */
if ( x > T3P8 )
{
y = PIO2L;
x = -( 1 .0 L/x );
}
else if ( x > TP8 )
{
y = PIO4L;
x = (x-1 .0 L)/(x+1 .0 L);
}
else
y = 0 .0 L;
/* rational form in x**2 */
z = x * x;
y = y + ( polevll( z, P, 4 ) / p1evll( z, Q, 5 ) ) * z * x + x;
if ( sign < 0 )
y = -y;
return (y);
}
/* atan2 */
extern long double PIL, PIO2L, MAXNUML;
#if ANSIC
long double atan2l( y, x )
#else
long double atan2l( x, y )
#endif
long double x, y;
{
long double z, w;
short code;
code = 0 ;
if ( x < 0 .0 L )
code = 2 ;
if ( y < 0 .0 L )
code |= 1 ;
#ifdef NANS
if ( isnanl(x) )
return (x);
if ( isnanl(y) )
return (y);
#endif
#ifdef MINUSZERO
if ( y == 0 .0 L )
{
if ( signbitl(y) )
{
if ( x > 0 .0 L )
z = y;
else if ( x < 0 .0 L )
z = -PIL;
else
{
if ( signbitl(x) )
z = -PIL;
else
z = y;
}
}
else /* y is +0 */
{
if ( x == 0 .0 L )
{
if ( signbitl(x) )
z = PIL;
else
z = 0 .0 L;
}
else if ( x > 0 .0 L )
z = 0 .0 L;
else
z = PIL;
}
return z;
}
if ( x == 0 .0 L )
{
if ( y > 0 .0 L )
z = PIO2L;
else
z = -PIO2L;
return z;
}
#endif /* MINUSZERO */
#ifdef INFINITIES
if ( x == INFINITYL )
{
if ( y == INFINITYL )
z = 0 .25 L * PIL;
else if ( y == -INFINITYL )
z = -0 .25 L * PIL;
else if ( y < 0 .0 L )
z = NEGZEROL;
else
z = 0 .0 L;
return z;
}
if ( x == -INFINITYL )
{
if ( y == INFINITYL )
z = 0 .75 L * PIL;
else if ( y == -INFINITYL )
z = -0 .75 L * PIL;
else if ( y >= 0 .0 L )
z = PIL;
else
z = -PIL;
return z;
}
if ( y == INFINITYL )
return ( PIO2L );
if ( y == -INFINITYL )
return ( -PIO2L );
#endif /* INFINITIES */
#ifdef INFINITIES
if ( x == 0 .0 L )
#else
if ( fabsl(x) <= (fabsl(y) / MAXNUML) )
#endif
{
if ( code & 1 )
{
#if ANSIC
return ( -PIO2L );
#else
return ( 3 .0 L*PIO2L );
#endif
}
if ( y == 0 .0 L )
return ( 0 .0 L );
return ( PIO2L );
}
if ( y == 0 .0 L )
{
if ( code & 2 )
return ( PIL );
return ( 0 .0 L );
}
switch ( code )
{
default :
#if ANSIC
case 0 :
case 1 : w = 0 .0 L; break ;
case 2 : w = PIL; break ;
case 3 : w = -PIL; break ;
#else
case 0 : w = 0 .0 L; break ;
case 1 : w = 2 .0 L * PIL; break ;
case 2 :
case 3 : w = PIL; break ;
#endif
}
z = w + atanl( y/x );
#ifdef MINUSZERO
if ( z == 0 .0 L && y < 0 .0 L )
z = NEGZEROL;
#endif
return ( z );
}
Messung V0.5 in Prozent C=95 H=100 G=97
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-13)
¤
*© Formatika GbR, Deutschland