mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2025-01-01 06:23:39 +01:00
c977aa998f
Replace amos with slatec
98 lines
5.1 KiB
Fortran
98 lines
5.1 KiB
Fortran
*DECK DLNREL
|
|
DOUBLE PRECISION FUNCTION DLNREL (X)
|
|
C***BEGIN PROLOGUE DLNREL
|
|
C***PURPOSE Evaluate ln(1+X) accurate in the sense of relative error.
|
|
C***LIBRARY SLATEC (FNLIB)
|
|
C***CATEGORY C4B
|
|
C***TYPE DOUBLE PRECISION (ALNREL-S, DLNREL-D, CLNREL-C)
|
|
C***KEYWORDS ELEMENTARY FUNCTIONS, FNLIB, LOGARITHM
|
|
C***AUTHOR Fullerton, W., (LANL)
|
|
C***DESCRIPTION
|
|
C
|
|
C DLNREL(X) calculates the double precision natural logarithm of
|
|
C (1.0+X) for double precision argument X. This routine should
|
|
C be used when X is small and accurate to calculate the logarithm
|
|
C accurately (in the relative error sense) in the neighborhood
|
|
C of 1.0.
|
|
C
|
|
C Series for ALNR on the interval -3.75000E-01 to 3.75000E-01
|
|
C with weighted error 6.35E-32
|
|
C log weighted error 31.20
|
|
C significant figures required 30.93
|
|
C decimal places required 32.01
|
|
C
|
|
C***REFERENCES (NONE)
|
|
C***ROUTINES CALLED D1MACH, DCSEVL, INITDS, XERMSG
|
|
C***REVISION HISTORY (YYMMDD)
|
|
C 770601 DATE WRITTEN
|
|
C 890531 Changed all specific intrinsics to generic. (WRB)
|
|
C 890531 REVISION DATE from Version 3.2
|
|
C 891214 Prologue converted to Version 4.0 format. (BAB)
|
|
C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
|
|
C***END PROLOGUE DLNREL
|
|
DOUBLE PRECISION ALNRCS(43), X, XMIN, DCSEVL, D1MACH
|
|
LOGICAL FIRST
|
|
SAVE ALNRCS, NLNREL, XMIN, FIRST
|
|
DATA ALNRCS( 1) / +.1037869356 2743769800 6862677190 98 D+1 /
|
|
DATA ALNRCS( 2) / -.1336430150 4908918098 7660415531 33 D+0 /
|
|
DATA ALNRCS( 3) / +.1940824913 5520563357 9261993747 50 D-1 /
|
|
DATA ALNRCS( 4) / -.3010755112 7535777690 3765377765 92 D-2 /
|
|
DATA ALNRCS( 5) / +.4869461479 7154850090 4563665091 37 D-3 /
|
|
DATA ALNRCS( 6) / -.8105488189 3175356066 8099430086 22 D-4 /
|
|
DATA ALNRCS( 7) / +.1377884779 9559524782 9382514960 59 D-4 /
|
|
DATA ALNRCS( 8) / -.2380221089 4358970251 3699929149 35 D-5 /
|
|
DATA ALNRCS( 9) / +.4164041621 3865183476 3918599019 89 D-6 /
|
|
DATA ALNRCS( 10) / -.7359582837 8075994984 2668370319 98 D-7 /
|
|
DATA ALNRCS( 11) / +.1311761187 6241674949 1522943450 11 D-7 /
|
|
DATA ALNRCS( 12) / -.2354670931 7742425136 6960923301 75 D-8 /
|
|
DATA ALNRCS( 13) / +.4252277327 6034997775 6380529625 67 D-9 /
|
|
DATA ALNRCS( 14) / -.7719089413 4840796826 1081074933 00 D-10 /
|
|
DATA ALNRCS( 15) / +.1407574648 1359069909 2153564721 91 D-10 /
|
|
DATA ALNRCS( 16) / -.2576907205 8024680627 5370786275 84 D-11 /
|
|
DATA ALNRCS( 17) / +.4734240666 6294421849 1543950059 38 D-12 /
|
|
DATA ALNRCS( 18) / -.8724901267 4742641745 3012632926 75 D-13 /
|
|
DATA ALNRCS( 19) / +.1612461490 2740551465 7398331191 15 D-13 /
|
|
DATA ALNRCS( 20) / -.2987565201 5665773006 7107924168 15 D-14 /
|
|
DATA ALNRCS( 21) / +.5548070120 9082887983 0413216972 79 D-15 /
|
|
DATA ALNRCS( 22) / -.1032461915 8271569595 1413339619 32 D-15 /
|
|
DATA ALNRCS( 23) / +.1925023920 3049851177 8785032448 68 D-16 /
|
|
DATA ALNRCS( 24) / -.3595507346 5265150011 1897078442 66 D-17 /
|
|
DATA ALNRCS( 25) / +.6726454253 7876857892 1945742267 73 D-18 /
|
|
DATA ALNRCS( 26) / -.1260262416 8735219252 0824256375 46 D-18 /
|
|
DATA ALNRCS( 27) / +.2364488440 8606210044 9161589555 19 D-19 /
|
|
DATA ALNRCS( 28) / -.4441937705 0807936898 8783891797 33 D-20 /
|
|
DATA ALNRCS( 29) / +.8354659446 4034259016 2412939946 66 D-21 /
|
|
DATA ALNRCS( 30) / -.1573155941 6479562574 8992535210 66 D-21 /
|
|
DATA ALNRCS( 31) / +.2965312874 0247422686 1543697066 66 D-22 /
|
|
DATA ALNRCS( 32) / -.5594958348 1815947292 1560132266 66 D-23 /
|
|
DATA ALNRCS( 33) / +.1056635426 8835681048 1872841386 66 D-23 /
|
|
DATA ALNRCS( 34) / -.1997248368 0670204548 3149994666 66 D-24 /
|
|
DATA ALNRCS( 35) / +.3778297781 8839361421 0498559999 99 D-25 /
|
|
DATA ALNRCS( 36) / -.7153158688 9081740345 0381653333 33 D-26 /
|
|
DATA ALNRCS( 37) / +.1355248846 3674213646 5020245333 33 D-26 /
|
|
DATA ALNRCS( 38) / -.2569467304 8487567430 0798293333 33 D-27 /
|
|
DATA ALNRCS( 39) / +.4874775606 6216949076 4595199999 99 D-28 /
|
|
DATA ALNRCS( 40) / -.9254211253 0849715321 1323733333 33 D-29 /
|
|
DATA ALNRCS( 41) / +.1757859784 1760239233 2697600000 00 D-29 /
|
|
DATA ALNRCS( 42) / -.3341002667 7731010351 3770666666 66 D-30 /
|
|
DATA ALNRCS( 43) / +.6353393618 0236187354 1802666666 66 D-31 /
|
|
DATA FIRST /.TRUE./
|
|
C***FIRST EXECUTABLE STATEMENT DLNREL
|
|
IF (FIRST) THEN
|
|
NLNREL = INITDS (ALNRCS, 43, 0.1*REAL(D1MACH(3)))
|
|
XMIN = -1.0D0 + SQRT(D1MACH(4))
|
|
ENDIF
|
|
FIRST = .FALSE.
|
|
C
|
|
IF (X .LE. (-1.D0)) CALL XERMSG ('SLATEC', 'DLNREL', 'X IS LE -1'
|
|
+ , 2, 2)
|
|
IF (X .LT. XMIN) CALL XERMSG ('SLATEC', 'DLNREL',
|
|
+ 'ANSWER LT HALF PRECISION BECAUSE X TOO NEAR -1', 1, 1)
|
|
C
|
|
IF (ABS(X).LE.0.375D0) DLNREL = X*(1.D0 -
|
|
1 X*DCSEVL (X/.375D0, ALNRCS, NLNREL))
|
|
C
|
|
IF (ABS(X).GT.0.375D0) DLNREL = LOG (1.0D0+X)
|
|
C
|
|
RETURN
|
|
END
|