/* dawsn.c
*
* Dawson ' s Integral
*
*
*
* SYNOPSIS :
*
* double x , y , dawsn ( ) ;
*
* y = dawsn ( x ) ;
*
*
*
* DESCRIPTION :
*
* Approximates the integral
*
* x
* -
* 2 | | 2
* dawsn ( x ) = exp ( - x ) | exp ( t ) dt
* | |
* -
* 0
*
* Three different rational approximations are employed , for
* the intervals 0 to 3 . 25 ; 3 . 25 to 6 . 25 ; and 6 . 25 up .
*
*
* ACCURACY :
*
* Relative error :
* arithmetic domain # trials peak rms
* IEEE 0 , 10 10000 6 . 9 e - 16 1 . 0 e - 16
* DEC 0 , 10 6000 7 . 4 e - 17 1 . 4 e - 17
*
*
*/
/* dawsn.c */
/*
Cephes Math Library Release 2 . 8 : June , 2000
Copyright 1984 , 1987 , 1989 , 2000 by Stephen L . Moshier
*/
#include "mconf.h"
/* Dawson's integral, interval 0 to 3.25 */
#ifdef UNK
static double AN[10 ] = {
1 .13681498971755972054 E-11 ,
8 .49262267667473811108 E-10 ,
1 .94434204175553054283 E-8 ,
9 .53151741254484363489 E-7 ,
3 .07828309874913200438 E-6 ,
3 .52513368520288738649 E-4 ,
-8 .50149846724410912031 E-4 ,
4 .22618223005546594270 E-2 ,
-9 .17480371773452345351 E-2 ,
9 .99999999999999994612 E-1 ,
};
static double AD[11 ] = {
2 .40372073066762605484 E-11 ,
1 .48864681368493396752 E-9 ,
5 .21265281010541664570 E-8 ,
1 .27258478273186970203 E-6 ,
2 .32490249820789513991 E-5 ,
3 .25524741826057911661 E-4 ,
3 .48805814657162590916 E-3 ,
2 .79448531198828973716 E-2 ,
1 .58874241960120565368 E-1 ,
5 .74918629489320327824 E-1 ,
1 .00000000000000000539 E0,
};
#endif
#ifdef DEC
static unsigned short AN[40 ] = {
0027107 ,0176630 ,0075752 ,0107612 ,
0030551 ,0070604 ,0166707 ,0127727 ,
0031647 ,0002210 ,0117120 ,0056376 ,
0033177 ,0156026 ,0141275 ,0140627 ,
0033516 ,0112200 ,0037035 ,0165515 ,
0035270 ,0150613 ,0016423 ,0105634 ,
0135536 ,0156227 ,0023515 ,0044413 ,
0037055 ,0015273 ,0105147 ,0064025 ,
0137273 ,0163145 ,0014460 ,0166465 ,
0040200 ,0000000 ,0000000 ,0000000 ,
};
static unsigned short AD[44 ] = {
0027323 ,0067372 ,0115566 ,0131320 ,
0030714 ,0114432 ,0074206 ,0006637 ,
0032137 ,0160671 ,0044203 ,0026344 ,
0033252 ,0146656 ,0020247 ,0100231 ,
0034303 ,0003346 ,0123260 ,0022433 ,
0035252 ,0125460 ,0173041 ,0155415 ,
0036144 ,0113747 ,0125203 ,0124617 ,
0036744 ,0166232 ,0143671 ,0133670 ,
0037442 ,0127755 ,0162625 ,0000100 ,
0040023 ,0026736 ,0003604 ,0106265 ,
0040200 ,0000000 ,0000000 ,0000000 ,
};
#endif
#ifdef IBMPC
static unsigned short AN[40 ] = {
0 x51f1,0 x0f7d,0 xffb3,0 x3da8,
0 xf5fb,0 x9db8,0 x2e30,0 x3e0d,
0 x0ba0,0 x13ca,0 xe091,0 x3e54,
0 xb833,0 xd857,0 xfb82,0 x3eaf,
0 xbd6a,0 x07c3,0 xd290,0 x3ec9,
0 x7174,0 x63a2,0 x1a31,0 x3f37,
0 xa921,0 xe4e9,0 xdb92,0 xbf4b,
0 xed03,0 x714c,0 xa357,0 x3fa5,
0 x1da7,0 xa326,0 x7ccc,0 xbfb7,
0 x0000,0 x0000,0 x0000,0 x3ff0,
};
static unsigned short AD[44 ] = {
0 xd65a,0 x536e,0 x6ddf,0 x3dba,
0 xc1b4,0 x4f10,0 x9323,0 x3e19,
0 x659c,0 x2910,0 xfc37,0 x3e6b,
0 xf013,0 xc414,0 x59b5,0 x3eb5,
0 x04a3,0 xd4d6,0 x60dc,0 x3ef8,
0 x3b62,0 x1ec4,0 x5566,0 x3f35,
0 x7532,0 xf550,0 x92fc,0 x3f6c,
0 x36f7,0 x58f7,0 x9d93,0 x3f9c,
0 xa008,0 xbcb2,0 x55fd,0 x3fc4,
0 x9197,0 xc0f0,0 x65bb,0 x3fe2,
0 x0000,0 x0000,0 x0000,0 x3ff0,
};
#endif
#ifdef MIEEE
static unsigned short AN[40 ] = {
0 x3da8,0 xffb3,0 x0f7d,0 x51f1,
0 x3e0d,0 x2e30,0 x9db8,0 xf5fb,
0 x3e54,0 xe091,0 x13ca,0 x0ba0,
0 x3eaf,0 xfb82,0 xd857,0 xb833,
0 x3ec9,0 xd290,0 x07c3,0 xbd6a,
0 x3f37,0 x1a31,0 x63a2,0 x7174,
0 xbf4b,0 xdb92,0 xe4e9,0 xa921,
0 x3fa5,0 xa357,0 x714c,0 xed03,
0 xbfb7,0 x7ccc,0 xa326,0 x1da7,
0 x3ff0,0 x0000,0 x0000,0 x0000,
};
static unsigned short AD[44 ] = {
0 x3dba,0 x6ddf,0 x536e,0 xd65a,
0 x3e19,0 x9323,0 x4f10,0 xc1b4,
0 x3e6b,0 xfc37,0 x2910,0 x659c,
0 x3eb5,0 x59b5,0 xc414,0 xf013,
0 x3ef8,0 x60dc,0 xd4d6,0 x04a3,
0 x3f35,0 x5566,0 x1ec4,0 x3b62,
0 x3f6c,0 x92fc,0 xf550,0 x7532,
0 x3f9c,0 x9d93,0 x58f7,0 x36f7,
0 x3fc4,0 x55fd,0 xbcb2,0 xa008,
0 x3fe2,0 x65bb,0 xc0f0,0 x9197,
0 x3ff0,0 x0000,0 x0000,0 x0000,
};
#endif
/* interval 3.25 to 6.25 */
#ifdef UNK
static double BN[11 ] = {
5 .08955156417900903354 E-1 ,
-2 .44754418142697847934 E-1 ,
9 .41512335303534411857 E-2 ,
-2 .18711255142039025206 E-2 ,
3 .66207612329569181322 E-3 ,
-4 .23209114460388756528 E-4 ,
3 .59641304793896631888 E-5 ,
-2 .14640351719968974225 E-6 ,
9 .10010780076391431042 E-8 ,
-2 .40274520828250956942 E-9 ,
3 .59233385440928410398 E-11 ,
};
static double BD[10 ] = {
/* 1.00000000000000000000E0,*/
-6 .31839869873368190192 E-1 ,
2 .36706788228248691528 E-1 ,
-5 .31806367003223277662 E-2 ,
8 .48041718586295374409 E-3 ,
-9 .47996768486665330168 E-4 ,
7 .81025592944552338085 E-5 ,
-4 .55875153252442634831 E-6 ,
1 .89100358111421846170 E-7 ,
-4 .91324691331920606875 E-9 ,
7 .18466403235734541950 E-11 ,
};
#endif
#ifdef DEC
static unsigned short BN[44 ] = {
0040002 ,0045342 ,0113762 ,0004360 ,
0137572 ,0120346 ,0172745 ,0144046 ,
0037300 ,0151134 ,0123440 ,0117047 ,
0136663 ,0025423 ,0014755 ,0046026 ,
0036157 ,0177561 ,0027535 ,0046744 ,
0135335 ,0161052 ,0071243 ,0146535 ,
0034426 ,0154060 ,0164506 ,0135625 ,
0133420 ,0005356 ,0100017 ,0151334 ,
0032303 ,0066137 ,0024013 ,0046212 ,
0131045 ,0016612 ,0066270 ,0047574 ,
0027435 ,0177025 ,0060625 ,0116363 ,
};
static unsigned short BD[40 ] = {
/*0040200,0000000,0000000,0000000,*/
0140041 ,0140101 ,0174552 ,0037073 ,
0037562 ,0061503 ,0124271 ,0160756 ,
0137131 ,0151760 ,0073210 ,0110534 ,
0036412 ,0170562 ,0117017 ,0155377 ,
0135570 ,0101374 ,0074056 ,0037276 ,
0034643 ,0145376 ,0001516 ,0060636 ,
0133630 ,0173540 ,0121344 ,0155231 ,
0032513 ,0005602 ,0134516 ,0007144 ,
0131250 ,0150540 ,0075747 ,0105341 ,
0027635 ,0177020 ,0012465 ,0125402 ,
};
#endif
#ifdef IBMPC
static unsigned short BN[44 ] = {
0 x411e,0 x52fe,0 x495c,0 x3fe0,
0 xb905,0 xdebc,0 x541c,0 xbfcf,
0 x13c5,0 x94e4,0 x1a4b,0 x3fb8,
0 xa983,0 x633d,0 x6562,0 xbf96,
0 xa9bd,0 x25eb,0 xffee,0 x3f6d,
0 x79ac,0 x4e54,0 xbc45,0 xbf3b,
0 xd773,0 x1d28,0 xdb06,0 x3f02,
0 xfa5b,0 xd001,0 x015d,0 xbec2,
0 x6991,0 xe501,0 x6d8b,0 x3e78,
0 x09f0,0 x4d97,0 xa3b1,0 xbe24,
0 xb39e,0 xac32,0 xbfc2,0 x3dc3,
};
static unsigned short BD[40 ] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 x47c7,0 x3f2d,0 x3808,0 xbfe4,
0 x3c3e,0 x7517,0 x4c68,0 x3fce,
0 x122b,0 x0ed1,0 x3a7e,0 xbfab,
0 xfb60,0 x53c1,0 x5e2e,0 x3f81,
0 xc7d8,0 x8f05,0 x105f,0 xbf4f,
0 xcc34,0 xc069,0 x795f,0 x3f14,
0 x9b53,0 x145c,0 x1eec,0 xbed3,
0 xc1cd,0 x5729,0 x6170,0 x3e89,
0 xf15c,0 x0f7c,0 x1a2c,0 xbe35,
0 xb560,0 x02a6,0 xbfc2,0 x3dd3,
};
#endif
#ifdef MIEEE
static unsigned short BN[44 ] = {
0 x3fe0,0 x495c,0 x52fe,0 x411e,
0 xbfcf,0 x541c,0 xdebc,0 xb905,
0 x3fb8,0 x1a4b,0 x94e4,0 x13c5,
0 xbf96,0 x6562,0 x633d,0 xa983,
0 x3f6d,0 xffee,0 x25eb,0 xa9bd,
0 xbf3b,0 xbc45,0 x4e54,0 x79ac,
0 x3f02,0 xdb06,0 x1d28,0 xd773,
0 xbec2,0 x015d,0 xd001,0 xfa5b,
0 x3e78,0 x6d8b,0 xe501,0 x6991,
0 xbe24,0 xa3b1,0 x4d97,0 x09f0,
0 x3dc3,0 xbfc2,0 xac32,0 xb39e,
};
static unsigned short BD[40 ] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 xbfe4,0 x3808,0 x3f2d,0 x47c7,
0 x3fce,0 x4c68,0 x7517,0 x3c3e,
0 xbfab,0 x3a7e,0 x0ed1,0 x122b,
0 x3f81,0 x5e2e,0 x53c1,0 xfb60,
0 xbf4f,0 x105f,0 x8f05,0 xc7d8,
0 x3f14,0 x795f,0 xc069,0 xcc34,
0 xbed3,0 x1eec,0 x145c,0 x9b53,
0 x3e89,0 x6170,0 x5729,0 xc1cd,
0 xbe35,0 x1a2c,0 x0f7c,0 xf15c,
0 x3dd3,0 xbfc2,0 x02a6,0 xb560,
};
#endif
/* 6.25 to infinity */
#ifdef UNK
static double CN[5 ] = {
-5 .90592860534773254987 E-1 ,
6 .29235242724368800674 E-1 ,
-1 .72858975380388136411 E-1 ,
1 .64837047825189632310 E-2 ,
-4 .86827613020462700845 E-4 ,
};
static double CD[5 ] = {
/* 1.00000000000000000000E0,*/
-2 .69820057197544900361 E0,
1 .73270799045947845857 E0,
-3 .93708582281939493482 E-1 ,
3 .44278924041233391079 E-2 ,
-9 .73655226040941223894 E-4 ,
};
#endif
#ifdef DEC
static unsigned short CN[20 ] = {
0140027 ,0030427 ,0176477 ,0074402 ,
0040041 ,0012617 ,0112375 ,0162657 ,
0137461 ,0000761 ,0074120 ,0135160 ,
0036607 ,0004325 ,0117246 ,0115525 ,
0135377 ,0036345 ,0064750 ,0047732 ,
};
static unsigned short CD[20 ] = {
/*0040200,0000000,0000000,0000000,*/
0140454 ,0127521 ,0071653 ,0133415 ,
0040335 ,0144540 ,0016105 ,0045241 ,
0137711 ,0112053 ,0155034 ,0062237 ,
0037015 ,0002102 ,0177442 ,0074546 ,
0135577 ,0036345 ,0064750 ,0052152 ,
};
#endif
#ifdef IBMPC
static unsigned short CN[20 ] = {
0 xef20,0 xffa7,0 xe622,0 xbfe2,
0 xbcb6,0 xf29f,0 x22b1,0 x3fe4,
0 x174e,0 x2f0a,0 x203e,0 xbfc6,
0 xd36b,0 xb3d4,0 xe11a,0 x3f90,
0 x09fb,0 xad3d,0 xe79c,0 xbf3f,
};
static unsigned short CD[20 ] = {
/*0x0000,0x0000,0x0000,0x3ff0,*/
0 x76e2,0 x2e75,0 x95ea,0 xc005,
0 xa954,0 x0388,0 xb92c,0 x3ffb,
0 x8c94,0 x7b43,0 x3285,0 xbfd9,
0 x4f2d,0 x5fe4,0 xa088,0 x3fa1,
0 x0a8d,0 xad3d,0 xe79c,0 xbf4f,
};
#endif
#ifdef MIEEE
static unsigned short CN[20 ] = {
0 xbfe2,0 xe622,0 xffa7,0 xef20,
0 x3fe4,0 x22b1,0 xf29f,0 xbcb6,
0 xbfc6,0 x203e,0 x2f0a,0 x174e,
0 x3f90,0 xe11a,0 xb3d4,0 xd36b,
0 xbf3f,0 xe79c,0 xad3d,0 x09fb,
};
static unsigned short CD[20 ] = {
/*0x3ff0,0x0000,0x0000,0x0000,*/
0 xc005,0 x95ea,0 x2e75,0 x76e2,
0 x3ffb,0 xb92c,0 x0388,0 xa954,
0 xbfd9,0 x3285,0 x7b43,0 x8c94,
0 x3fa1,0 xa088,0 x5fe4,0 x4f2d,
0 xbf4f,0 xe79c,0 xad3d,0 x0a8d,
};
#endif
#ifdef ANSIPROT
extern double chbevl ( double , void *, int );
extern double sqrt ( double );
extern double fabs ( double );
extern double polevl ( double , void *, int );
extern double p1evl ( double , void *, int );
#else
double chbevl(), sqrt(), fabs(), polevl(), p1evl();
#endif
extern double PI, MACHEP;
double dawsn( xx )
double xx;
{
double x, y;
int sign;
sign = 1 ;
if ( xx < 0 .0 )
{
sign = -1 ;
xx = -xx;
}
if ( xx < 3 .25 )
{
x = xx*xx;
y = xx * polevl( x, AN, 9 )/polevl( x, AD, 10 );
return ( sign * y );
}
x = 1 .0 /(xx*xx);
if ( xx < 6 .25 )
{
y = 1 .0 /xx + x * polevl( x, BN, 10 ) / (p1evl( x, BD, 10 ) * xx);
return ( sign * 0 .5 * y );
}
if ( xx > 1 .0 e9 )
return ( (sign * 0 .5 )/xx );
/* 6.25 to infinity */
y = 1 .0 /xx + x * polevl( x, CN, 4 ) / (p1evl( x, CD, 5 ) * xx);
return ( sign * 0 .5 * y );
}
Messung V0.5 in Prozent C=97 H=100 G=98