dlnrel.f

Go to the documentation of this file.
00001 *DECK DLNREL
00002       DOUBLE PRECISION FUNCTION DLNREL (X)
00003 C***BEGIN PROLOGUE  DLNREL
00004 C***PURPOSE  Evaluate ln(1+X) accurate in the sense of relative error.
00005 C***LIBRARY   SLATEC (FNLIB)
00006 C***CATEGORY  C4B
00007 C***TYPE      DOUBLE PRECISION (ALNREL-S, DLNREL-D, CLNREL-C)
00008 C***KEYWORDS  ELEMENTARY FUNCTIONS, FNLIB, LOGARITHM
00009 C***AUTHOR  Fullerton, W., (LANL)
00010 C***DESCRIPTION
00011 C
00012 C DLNREL(X) calculates the double precision natural logarithm of
00013 C (1.0+X) for double precision argument X.  This routine should
00014 C be used when X is small and accurate to calculate the logarithm
00015 C accurately (in the relative error sense) in the neighborhood
00016 C of 1.0.
00017 C
00018 C Series for ALNR       on the interval -3.75000E-01 to  3.75000E-01
00019 C                                        with weighted error   6.35E-32
00020 C                                         log weighted error  31.20
00021 C                               significant figures required  30.93
00022 C                                    decimal places required  32.01
00023 C
00024 C***REFERENCES  (NONE)
00025 C***ROUTINES CALLED  D1MACH, DCSEVL, INITDS, XERMSG
00026 C***REVISION HISTORY  (YYMMDD)
00027 C   770601  DATE WRITTEN
00028 C   890531  Changed all specific intrinsics to generic.  (WRB)
00029 C   890531  REVISION DATE from Version 3.2
00030 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00031 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00032 C***END PROLOGUE  DLNREL
00033       DOUBLE PRECISION ALNRCS(43), X, XMIN,  DCSEVL, D1MACH
00034       LOGICAL FIRST
00035       SAVE ALNRCS, NLNREL, XMIN, FIRST
00036       DATA ALNRCS(  1) / +.1037869356 2743769800 6862677190 98 D+1     /
00037       DATA ALNRCS(  2) / -.1336430150 4908918098 7660415531 33 D+0     /
00038       DATA ALNRCS(  3) / +.1940824913 5520563357 9261993747 50 D-1     /
00039       DATA ALNRCS(  4) / -.3010755112 7535777690 3765377765 92 D-2     /
00040       DATA ALNRCS(  5) / +.4869461479 7154850090 4563665091 37 D-3     /
00041       DATA ALNRCS(  6) / -.8105488189 3175356066 8099430086 22 D-4     /
00042       DATA ALNRCS(  7) / +.1377884779 9559524782 9382514960 59 D-4     /
00043       DATA ALNRCS(  8) / -.2380221089 4358970251 3699929149 35 D-5     /
00044       DATA ALNRCS(  9) / +.4164041621 3865183476 3918599019 89 D-6     /
00045       DATA ALNRCS( 10) / -.7359582837 8075994984 2668370319 98 D-7     /
00046       DATA ALNRCS( 11) / +.1311761187 6241674949 1522943450 11 D-7     /
00047       DATA ALNRCS( 12) / -.2354670931 7742425136 6960923301 75 D-8     /
00048       DATA ALNRCS( 13) / +.4252277327 6034997775 6380529625 67 D-9     /
00049       DATA ALNRCS( 14) / -.7719089413 4840796826 1081074933 00 D-10    /
00050       DATA ALNRCS( 15) / +.1407574648 1359069909 2153564721 91 D-10    /
00051       DATA ALNRCS( 16) / -.2576907205 8024680627 5370786275 84 D-11    /
00052       DATA ALNRCS( 17) / +.4734240666 6294421849 1543950059 38 D-12    /
00053       DATA ALNRCS( 18) / -.8724901267 4742641745 3012632926 75 D-13    /
00054       DATA ALNRCS( 19) / +.1612461490 2740551465 7398331191 15 D-13    /
00055       DATA ALNRCS( 20) / -.2987565201 5665773006 7107924168 15 D-14    /
00056       DATA ALNRCS( 21) / +.5548070120 9082887983 0413216972 79 D-15    /
00057       DATA ALNRCS( 22) / -.1032461915 8271569595 1413339619 32 D-15    /
00058       DATA ALNRCS( 23) / +.1925023920 3049851177 8785032448 68 D-16    /
00059       DATA ALNRCS( 24) / -.3595507346 5265150011 1897078442 66 D-17    /
00060       DATA ALNRCS( 25) / +.6726454253 7876857892 1945742267 73 D-18    /
00061       DATA ALNRCS( 26) / -.1260262416 8735219252 0824256375 46 D-18    /
00062       DATA ALNRCS( 27) / +.2364488440 8606210044 9161589555 19 D-19    /
00063       DATA ALNRCS( 28) / -.4441937705 0807936898 8783891797 33 D-20    /
00064       DATA ALNRCS( 29) / +.8354659446 4034259016 2412939946 66 D-21    /
00065       DATA ALNRCS( 30) / -.1573155941 6479562574 8992535210 66 D-21    /
00066       DATA ALNRCS( 31) / +.2965312874 0247422686 1543697066 66 D-22    /
00067       DATA ALNRCS( 32) / -.5594958348 1815947292 1560132266 66 D-23    /
00068       DATA ALNRCS( 33) / +.1056635426 8835681048 1872841386 66 D-23    /
00069       DATA ALNRCS( 34) / -.1997248368 0670204548 3149994666 66 D-24    /
00070       DATA ALNRCS( 35) / +.3778297781 8839361421 0498559999 99 D-25    /
00071       DATA ALNRCS( 36) / -.7153158688 9081740345 0381653333 33 D-26    /
00072       DATA ALNRCS( 37) / +.1355248846 3674213646 5020245333 33 D-26    /
00073       DATA ALNRCS( 38) / -.2569467304 8487567430 0798293333 33 D-27    /
00074       DATA ALNRCS( 39) / +.4874775606 6216949076 4595199999 99 D-28    /
00075       DATA ALNRCS( 40) / -.9254211253 0849715321 1323733333 33 D-29    /
00076       DATA ALNRCS( 41) / +.1757859784 1760239233 2697600000 00 D-29    /
00077       DATA ALNRCS( 42) / -.3341002667 7731010351 3770666666 66 D-30    /
00078       DATA ALNRCS( 43) / +.6353393618 0236187354 1802666666 66 D-31    /
00079       DATA FIRST /.TRUE./
00080 C***FIRST EXECUTABLE STATEMENT  DLNREL
00081       IF (FIRST) THEN
00082          NLNREL = INITDS (ALNRCS, 43, 0.1*REAL(D1MACH(3)))
00083          XMIN = -1.0D0 + SQRT(D1MACH(4))
00084       ENDIF
00085       FIRST = .FALSE.
00086 C
00087       IF (X .LE. (-1.D0)) CALL XERMSG ('SLATEC', 'DLNREL', 'X IS LE -1'
00088      +   , 2, 2)
00089       IF (X .LT. XMIN) CALL XERMSG ('SLATEC', 'DLNREL',
00090      +   'ANSWER LT HALF PRECISION BECAUSE X TOO NEAR -1', 1, 1)
00091 C
00092       IF (ABS(X).LE.0.375D0) DLNREL = X*(1.D0 -
00093      1  X*DCSEVL (X/.375D0, ALNRCS, NLNREL))
00094 C
00095       IF (ABS(X).GT.0.375D0) DLNREL = LOG (1.0D0+X)
00096 C
00097       RETURN
00098       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines