alnrel.f

Go to the documentation of this file.
00001 *DECK ALNREL
00002       FUNCTION ALNREL (X)
00003 C***BEGIN PROLOGUE  ALNREL
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      SINGLE 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 ALNREL(X) evaluates ln(1+X) accurately in the sense of relative
00013 C error when X is very small.  This routine must be used to
00014 C maintain relative error accuracy whenever X is small and
00015 C accurately known.
00016 C
00017 C Series for ALNR       on the interval -3.75000D-01 to  3.75000D-01
00018 C                                        with weighted error   1.93E-17
00019 C                                         log weighted error  16.72
00020 C                               significant figures required  16.44
00021 C                                    decimal places required  17.40
00022 C
00023 C***REFERENCES  (NONE)
00024 C***ROUTINES CALLED  CSEVL, INITS, R1MACH, XERMSG
00025 C***REVISION HISTORY  (YYMMDD)
00026 C   770401  DATE WRITTEN
00027 C   890531  Changed all specific intrinsics to generic.  (WRB)
00028 C   890531  REVISION DATE from Version 3.2
00029 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00030 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00031 C   900326  Removed duplicate information from DESCRIPTION section.
00032 C           (WRB)
00033 C***END PROLOGUE  ALNREL
00034       DIMENSION ALNRCS(23)
00035       LOGICAL FIRST
00036       SAVE ALNRCS, NLNREL, XMIN, FIRST
00037       DATA ALNRCS( 1) /   1.0378693562 743770E0 /
00038       DATA ALNRCS( 2) /   -.1336430150 4908918E0 /
00039       DATA ALNRCS( 3) /    .0194082491 35520563E0 /
00040       DATA ALNRCS( 4) /   -.0030107551 12753577E0 /
00041       DATA ALNRCS( 5) /    .0004869461 47971548E0 /
00042       DATA ALNRCS( 6) /   -.0000810548 81893175E0 /
00043       DATA ALNRCS( 7) /    .0000137788 47799559E0 /
00044       DATA ALNRCS( 8) /   -.0000023802 21089435E0 /
00045       DATA ALNRCS( 9) /    .0000004164 04162138E0 /
00046       DATA ALNRCS(10) /   -.0000000735 95828378E0 /
00047       DATA ALNRCS(11) /    .0000000131 17611876E0 /
00048       DATA ALNRCS(12) /   -.0000000023 54670931E0 /
00049       DATA ALNRCS(13) /    .0000000004 25227732E0 /
00050       DATA ALNRCS(14) /   -.0000000000 77190894E0 /
00051       DATA ALNRCS(15) /    .0000000000 14075746E0 /
00052       DATA ALNRCS(16) /   -.0000000000 02576907E0 /
00053       DATA ALNRCS(17) /    .0000000000 00473424E0 /
00054       DATA ALNRCS(18) /   -.0000000000 00087249E0 /
00055       DATA ALNRCS(19) /    .0000000000 00016124E0 /
00056       DATA ALNRCS(20) /   -.0000000000 00002987E0 /
00057       DATA ALNRCS(21) /    .0000000000 00000554E0 /
00058       DATA ALNRCS(22) /   -.0000000000 00000103E0 /
00059       DATA ALNRCS(23) /    .0000000000 00000019E0 /
00060       DATA FIRST /.TRUE./
00061 C***FIRST EXECUTABLE STATEMENT  ALNREL
00062       IF (FIRST) THEN
00063          NLNREL = INITS (ALNRCS, 23, 0.1*R1MACH(3))
00064          XMIN = -1.0 + SQRT(R1MACH(4))
00065       ENDIF
00066       FIRST = .FALSE.
00067 C
00068       IF (X .LE. (-1.0)) CALL XERMSG ('SLATEC', 'ALNREL', 'X IS LE -1',
00069      +   2, 2)
00070       IF (X .LT. XMIN) CALL XERMSG ('SLATEC', 'ALNREL',
00071      +   'ANSWER LT HALF PRECISION BECAUSE X TOO NEAR -1', 1, 1)
00072 C
00073       IF (ABS(X).LE.0.375) ALNREL = X*(1. -
00074      1  X*CSEVL (X/.375, ALNRCS, NLNREL))
00075       IF (ABS(X).GT.0.375) ALNREL = LOG (1.0+X)
00076 C
00077       RETURN
00078       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines