/* exp10l.c
*
* Base 10 exponential function , long double precision
* ( Common antilogarithm )
*
*
*
* SYNOPSIS :
*
* long double x , y , exp10l ( )
*
* y = exp10l ( x ) ;
*
*
*
* DESCRIPTION :
*
* Returns 10 raised to the x power .
*
* Range reduction is accomplished by expressing the argument
* as 10 * * x = 2 * * n 10 * * f , with | f | < 0 . 5 log10 ( 2 ) .
* The Pade ' form
*
* 1 + 2 x P ( x * * 2 ) / ( Q ( x * * 2 ) - P ( x * * 2 ) )
*
* is used to approximate 10 * * f .
*
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE + - 4900 30000 1 . 0 e - 19 2 . 7 e - 20
*
* ERROR MESSAGES :
*
* message condition value returned
* exp10l underflow x < - MAXL10 0 . 0
* exp10l overflow x > MAXL10 MAXNUM
*
* IEEE arithmetic : MAXL10 = 4932 . 0754489586679023819
*
*/
/*
Cephes Math Library Release 2 . 2 : January , 1991
Copyright 1984 , 1991 by Stephen L . Moshier
Direct inquiries to 30 Frost Street , Cambridge , MA 02140
*/
#include "mconf.h"
#ifdef UNK
static long double P[] = {
3 .1341179396892496811523 E1L,
4 .5618283154904699073999 E3L,
1 .3433113468542797218610 E5L,
7 .6025447914440301593592 E5L,
};
static long double Q[] = {
/* 1.0000000000000000000000E0,*/
4 .7705440288425157637739 E2L,
2 .9732606548049614870598 E4L,
4 .0843697951001026189583 E5L,
6 .6034865026929015925608 E5L,
};
/*static long double LOG102 = 3.0102999566398119521373889e-1L;*/
static long double LOG210 = 3 .3219280948873623478703 L;
static long double LG102A = 3 .01025390625 e-1 L;
static long double LG102B = 4 .6050389811952137388947 e-6 L;
#endif
#ifdef IBMPC
static short P[] = {
0 x399a,0 x7dc7,0 xbc43,0 xfaba,0 x4003, XPD
0 xb526,0 xdf32,0 xa063,0 x8e8e,0 x400b, XPD
0 x18da,0 xafa1,0 xc89e,0 x832e,0 x4010, XPD
0 x503d,0 x9352,0 xe7aa,0 xb99b,0 x4012, XPD
};
static short Q[] = {
/*0x0000,0x0000,0x0000,0x8000,0x3fff,*/
0 x947d,0 x7855,0 xf6ac,0 xee86,0 x4007, XPD
0 x18cf,0 x7749,0 x368d,0 xe849,0 x400d, XPD
0 x85be,0 x2560,0 x9f58,0 xc76e,0 x4011, XPD
0 x6d3c,0 x80c5,0 xca67,0 xa137,0 x4012, XPD
};
/*
static short L102 [ ] = { 0 xf799 , 0 xfbcf , 0 x9a84 , 0 x9a20 , 0 x3ffd , XPD } ;
# define LOG102 * ( long double * ) L102
*/
static short L210[] = {0 x8afe,0 xcd1b,0 x784b,0 xd49a,0 x4000, XPD};
#define LOG210 *(long double *)L210
static short L102A[] = {0 x0000,0 x0000,0 x0000,0 x9a20,0 x3ffd, XPD};
#define LG102A *(long double *)L102A
static short L102B[] = {0 x8f89,0 xf798,0 xfbcf,0 x9a84,0 x3fed, XPD};
#define LG102B *(long double *)L102B
#endif
#ifdef MIEEE
static long P[] = {
0 x40030000,0 xfababc43,0 x7dc7399a,
0 x400b0000,0 x8e8ea063,0 xdf32b526,
0 x40100000,0 x832ec89e,0 xafa118da,
0 x40120000,0 xb99be7aa,0 x9352503d,
};
static long Q[] = {
/* 0x3fff0000,0x80000000,0x00000000, */
0 x40070000,0 xee86f6ac,0 x7855947d,
0 x400d0000,0 xe849368d,0 x774918cf,
0 x40110000,0 xc76e9f58,0 x256085be,
0 x40120000,0 xa137ca67,0 x80c56d3c,
};
/*
static long L102 [ ] = { 0 x3ffd0000 , 0 x9a209a84 , 0 xfbcff799 } ;
# define LOG102 * ( long double * ) L102
*/
static long L210[] = {0 x40000000,0 xd49a784b,0 xcd1b8afe};
#define LOG210 *(long double *)L210
static long L102A[] = {0 x3ffd0000,0 x9a200000,0 x00000000};
#define LG102A *(long double *)L102A
static long L102B[] = {0 x3fed0000,0 x9a84fbcf,0 xf7988f89};
#define LG102B *(long double *)L102B
#endif
static long double MAXL10 = 4 .9320754489586679023819 e3L;
extern long double MAXNUML;
#ifdef ANSIPROT
extern long double floorl ( long double );
extern long double ldexpl ( long double , int );
extern long double polevll ( long double , void *, int );
extern long double p1evll ( long double , void *, int );
extern int isnanl ( long double );
#else
long double floorl(), ldexpl(), polevll(), p1evll(), isnanl();
#endif
#ifdef INFINITIES
extern long double INFINITYL;
#endif
long double exp10l(x)
long double x;
{
long double px, xx;
short n;
#ifdef NANS
if ( isnanl(x) )
return (x);
#endif
if ( x > MAXL10 )
{
#ifdef INFINITIES
return ( INFINITYL );
#else
mtherr( "exp10l" , OVERFLOW );
return ( MAXNUML );
#endif
}
if ( x < -MAXL10 ) /* Would like to use MINLOG but can't */
{
#ifndef INFINITIES
mtherr( "exp10l" , UNDERFLOW );
#endif
return (0 .0 L);
}
/* Express 10**x = 10**g 2**n
* = 10 * * g 10 * * ( n log10 ( 2 ) )
* = 10 * * ( g + n log10 ( 2 ) )
*/
px = floorl( LOG210 * x + 0 .5 L );
n = px;
x -= px * LG102A;
x -= px * LG102B;
/* rational approximation for exponential
* of the fractional part :
* 10 * * x = 1 + 2 x P ( x * * 2 ) / ( Q ( x * * 2 ) - P ( x * * 2 ) )
*/
xx = x * x;
px = x * polevll( xx, P, 3 );
x = px/( p1evll( xx, Q, 4 ) - px );
x = 1 .0 L + ldexpl( x, 1 );
/* multiply by power of 2 */
x = ldexpl( x, n );
return (x);
}
Messung V0.5 in Prozent C=94 H=100 G=96
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-22)
¤
*© Formatika GbR, Deutschland