/* exp10.c
*
* Base 10 exponential function
* ( Common antilogarithm )
*
*
*
* SYNOPSIS :
*
* double x , y , exp10 ( ) ;
*
* y = exp10 ( 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 - 307 , + 307 30000 2 . 2 e - 16 5 . 5 e - 17
* Test result from an earlier version ( 2 . 1 ) :
* DEC - 38 , + 38 70000 3 . 1 e - 17 7 . 0 e - 18
*
* ERROR MESSAGES :
*
* message condition value returned
* exp10 underflow x < - MAXL10 0 . 0
* exp10 overflow x > MAXL10 MAXNUM
*
* DEC arithmetic : MAXL10 = 38 . 230809449325611792 .
* IEEE arithmetic : MAXL10 = 308 . 2547155599167 .
*
*/
/*
Cephes Math Library Release 2 . 8 : June , 2000
Copyright 1984 , 1991 , 2000 by Stephen L . Moshier
*/
#include "mconf.h"
#ifdef UNK
static double P[] = {
4 .09962519798587023075 E-2 ,
1 .17452732554344059015 E1,
4 .06717289936872725516 E2,
2 .39423741207388267439 E3,
};
static double Q[] = {
/* 1.00000000000000000000E0,*/
8 .50936160849306532625 E1,
1 .27209271178345121210 E3,
2 .07960819286001865907 E3,
};
/* static double LOG102 = 3.01029995663981195214e-1; */
static double LOG210 = 3 .32192809488736234787 e0;
static double LG102A = 3 .01025390625000000000 E-1 ;
static double LG102B = 4 .60503898119521373889 E-6 ;
/* static double MAXL10 = 38.230809449325611792; */
static double MAXL10 = 308 .2547155599167 ;
#endif
#ifdef DEC
static unsigned short P[] = {
0037047 ,0165657 ,0114061 ,0067234 ,
0041073 ,0166243 ,0123052 ,0144643 ,
0042313 ,0055720 ,0024032 ,0047443 ,
0043025 ,0121714 ,0070232 ,0050007 ,
};
static unsigned short Q[] = {
/*0040200,0000000,0000000,0000000,*/
0041652 ,0027756 ,0071216 ,0050075 ,
0042637 ,0001367 ,0077263 ,0136017 ,
0043001 ,0174673 ,0024157 ,0133416 ,
};
/*
static unsigned short L102 [ ] = { 0037632 , 0020232 , 0102373 , 0147770 } ;
# define LOG102 * ( double * ) L102
*/
static unsigned short L210[] = {0040524 ,0115170 ,0045715 ,0015613 };
#define LOG210 *(double *)L210
static unsigned short L102A[] = {0037632 ,0020000 ,0000000 ,0000000 ,};
#define LG102A *(double *)L102A
static unsigned short L102B[] = {0033632 ,0102373 ,0147767 ,0114220 ,};
#define LG102B *(double *)L102B
static unsigned short MXL[] = {0041430 ,0166131 ,0047761 ,0154130 ,};
#define MAXL10 ( *(double *)MXL )
#endif
#ifdef IBMPC
static unsigned short P[] = {
0 x2dd4,0 xf306,0 xfd75,0 x3fa4,
0 x5934,0 x74c5,0 x7d94,0 x4027,
0 x49e4,0 x0503,0 x6b7a,0 x4079,
0 x4a01,0 x8e13,0 xb479,0 x40a2,
};
static unsigned short Q[] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 xca08,0 xce51,0 x45fd,0 x4055,
0 x7782,0 xefd6,0 xe05e,0 x4093,
0 xf6e2,0 x650d,0 x3f37,0 x40a0,
};
/*
static unsigned short L102 [ ] = { 0 x79ff , 0 x509f , 0 x4413 , 0 x3fd3 } ;
# define LOG102 * ( double * ) L102
*/
static unsigned short L210[] = {0 xa371,0 x0979,0 x934f,0 x400a};
#define LOG210 *(double *)L210
static unsigned short L102A[] = {0 x0000,0 x0000,0 x4400,0 x3fd3,};
#define LG102A *(double *)L102A
static unsigned short L102B[] = {0 xf312,0 x79fe,0 x509f,0 x3ed3,};
#define LG102B *(double *)L102B
static double MAXL10 = 308 .2547155599167 ;
#endif
#ifdef MIEEE
static unsigned short P[] = {
0 x3fa4,0 xfd75,0 xf306,0 x2dd4,
0 x4027,0 x7d94,0 x74c5,0 x5934,
0 x4079,0 x6b7a,0 x0503,0 x49e4,
0 x40a2,0 xb479,0 x8e13,0 x4a01,
};
static unsigned short Q[] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 x4055,0 x45fd,0 xce51,0 xca08,
0 x4093,0 xe05e,0 xefd6,0 x7782,
0 x40a0,0 x3f37,0 x650d,0 xf6e2,
};
/*
static unsigned short L102 [ ] = { 0 x3fd3 , 0 x4413 , 0 x509f , 0 x79ff } ;
# define LOG102 * ( double * ) L102
*/
static unsigned short L210[] = {0 x400a,0 x934f,0 x0979,0 xa371};
#define LOG210 *(double *)L210
static unsigned short L102A[] = {0 x3fd3,0 x4400,0 x0000,0 x0000,};
#define LG102A *(double *)L102A
static unsigned short L102B[] = {0 x3ed3,0 x509f,0 x79fe,0 xf312,};
#define LG102B *(double *)L102B
static double MAXL10 = 308 .2547155599167 ;
#endif
#ifdef ANSIPROT
extern double floor ( double );
extern double ldexp ( double , int );
extern double polevl ( double , void *, int );
extern double p1evl ( double , void *, int );
extern int isnan ( double );
extern int isfinite ( double );
#else
double floor(), ldexp(), polevl(), p1evl();
int isnan(), isfinite();
#endif
extern double MAXNUM;
#ifdef INFINITIES
extern double INFINITY;
#endif
double exp10(x)
double x;
{
double px, xx;
short n;
#ifdef NANS
if ( isnan(x) )
return (x);
#endif
if ( x > MAXL10 )
{
#ifdef INFINITIES
return ( INFINITY );
#else
mtherr( "exp10" , OVERFLOW );
return ( MAXNUM );
#endif
}
if ( x < -MAXL10 ) /* Would like to use MINLOG but can't */
{
#ifndef INFINITIES
mtherr( "exp10" , UNDERFLOW );
#endif
return (0 .0 );
}
/* Express 10**x = 10**g 2**n
* = 10 * * g 10 * * ( n log10 ( 2 ) )
* = 10 * * ( g + n log10 ( 2 ) )
*/
px = floor( LOG210 * x + 0 .5 );
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 * polevl( xx, P, 3 );
x = px/( p1evl( xx, Q, 3 ) - px );
x = 1 .0 + ldexp( x, 1 );
/* multiply by power of 2 */
x = ldexp( 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-17)
¤
*© Formatika GbR, Deutschland