/* asinl.c
*
* Inverse circular sine , long double precision
*
*
*
* SYNOPSIS :
*
* double x , y , asinl ( ) ;
*
* y = asinl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns radian angle between - pi / 2 and + pi / 2 whose sine is x .
*
* A rational function of the form x + x * * 3 P ( x * * 2 ) / Q ( x * * 2 )
* is used for | x | in the interval [ 0 , 0 . 5 ] . If | x | > 0 . 5 it is
* transformed by the identity
*
* asin ( x ) = pi / 2 - 2 asin ( sqrt ( ( 1 - x ) / 2 ) ) .
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE - 1 , 1 30000 2 . 7 e - 19 4 . 8 e - 20
*
*
* ERROR MESSAGES :
*
* message condition value returned
* asinl domain | x | > 1 NANL
*
*/
/* acosl()
*
* Inverse circular cosine , long double precision
*
*
*
* SYNOPSIS :
*
* double x , y , acosl ( ) ;
*
* y = acosl ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns radian angle between - pi / 2 and + pi / 2 whose cosine
* is x .
*
* Analytically , acos ( x ) = pi / 2 - asin ( x ) . However if | x | is
* near 1 , there is cancellation error in subtracting asin ( x )
* from pi / 2 . Hence if x < - 0 . 5 ,
*
* acos ( x ) = pi - 2 . 0 * asin ( sqrt ( ( 1 + x ) / 2 ) ) ;
*
* or if x > + 0 . 5 ,
*
* acos ( x ) = 2 . 0 * asin ( sqrt ( ( 1 - x ) / 2 ) ) .
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE - 1 , 1 30000 1 . 4 e - 19 3 . 5 e - 20
*
*
* ERROR MESSAGES :
*
* message condition value returned
* acosl domain | x | > 1 NANL
*/
/* asin.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[] = {
3 .7769340062433674871612 E-3 L,
-6 .1212919176969202969441 E-1 L,
5 .9303993515791417710775 E0L,
-1 .8631697621590161441592 E1L,
2 .3314603132141795720634 E1L,
-1 .0087146579384916260197 E1L,
};
static long double Q[] = {
/* 1.0000000000000000000000E0L,*/
-1 .5684335624873146511217 E1L,
7 .8702951549021104258866 E1L,
-1 .7078401170625864261444 E2L,
1 .6712291455718995937376 E2L,
-6 .0522879476309497128868 E1L,
};
#endif
#ifdef IBMPC
static short P[] = {
0 x59d1,0 x3509,0 x7009,0 xf786,0 x3ff6, XPD
0 xbe97,0 x93e6,0 x7fab,0 x9cb4,0 xbffe, XPD
0 x8bf5,0 x6810,0 xd4dc,0 xbdc5,0 x4001, XPD
0 x9bd4,0 x8d86,0 xb77b,0 x950d,0 xc003, XPD
0 x3b0f,0 x9e25,0 x4ea5,0 xba84,0 x4003, XPD
0 xea38,0 xc6a9,0 xf3cf,0 xa164,0 xc002, XPD
};
static short Q[] = {
/*0x0000,0x0000,0x0000,0x8000,0x3fff,*/
0 x1229,0 x8516,0 x09e9,0 xfaf3,0 xc002, XPD
0 xb5c3,0 xf36f,0 xe943,0 x9d67,0 x4005, XPD
0 xe11a,0 xbe0f,0 xb4fd,0 xaac8,0 xc006, XPD
0 x4c69,0 x1355,0 x7754,0 xa71f,0 x4006, XPD
0 xded7,0 xa9fe,0 x6db7,0 xf217,0 xc004, XPD
};
#endif
#ifdef MIEEE
static long P[] = {
0 x3ff60000,0 xf7867009,0 x350959d1,
0 xbffe0000,0 x9cb47fab,0 x93e6be97,
0 x40010000,0 xbdc5d4dc,0 x68108bf5,
0 xc0030000,0 x950db77b,0 x8d869bd4,
0 x40030000,0 xba844ea5,0 x9e253b0f,
0 xc0020000,0 xa164f3cf,0 xc6a9ea38,
};
static long Q[] = {
/*0x3fff0000,0x80000000,0x00000000,*/
0 xc0020000,0 xfaf309e9,0 x85161229,
0 x40050000,0 x9d67e943,0 xf36fb5c3,
0 xc0060000,0 xaac8b4fd,0 xbe0fe11a,
0 x40060000,0 xa71f7754,0 x13554c69,
0 xc0040000,0 xf2176db7,0 xa9feded7,
};
#endif
#ifdef NANS
extern long double NANL;
#endif
#ifdef ANSIPROT
extern long double ldexpl ( long double , int );
extern long double sqrtl ( long double );
extern long double polevll ( long double , void *, int );
extern long double p1evll ( long double , void *, int );
long double asinl ( long double );
#else
long double ldexpl(), sqrtl(), polevll(), p1evll();
long double asinl();
#endif
long double asinl(x)
long double x;
{
long double a, p, z, zz;
short sign, flag;
extern long double PIO2L;
if ( x > 0 )
{
sign = 1 ;
a = x;
}
else
{
sign = -1 ;
a = -x;
}
if ( a > 1 .0 L )
{
mtherr( "asinl" , DOMAIN );
#ifdef NANS
return ( NANL );
#else
return ( 0 .0 L );
#endif
}
if ( a < 1 .0 e-10 L )
{
z = a;
goto done;
}
if ( a > 0 .5 L )
{
zz = 0 .5 L -a;
zz = ldexpl( zz + 0 .5 L, -1 );
z = sqrtl( zz );
flag = 1 ;
}
else
{
z = a;
zz = z * z;
flag = 0 ;
}
p = zz * polevll( zz, P, 5 )/p1evll( zz, Q, 5 );
z = z * p + z;
if ( flag != 0 )
{
z = z + z;
z = PIO2L - z;
}
done:
if ( sign < 0 )
z = -z;
return (z);
}
extern long double PIO2L, PIL;
long double acosl(x)
long double x;
{
if ( x < -1 .0 L )
goto domerr;
if ( x < -0 .5 L)
return ( PIL - 2 .0 L * asinl( sqrtl(0 .5 L*(1 .0 L+x)) ) );
if ( x > 1 .0 L )
{
domerr: mtherr( "acosl" , DOMAIN );
#ifdef NANS
return ( NANL );
#else
return ( 0 .0 L );
#endif
}
if ( x > 0 .5 L )
return ( 2 .0 L * asinl( sqrtl(0 .5 L*(1 .0 L-x) ) ) );
return ( PIO2L - asinl(x) );
}
Messung V0.5 in Prozent C=98 H=96 G=96
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-14)
¤
*© Formatika GbR, Deutschland