GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
alnrel.f
Go to the documentation of this file.
1*DECK ALNREL
2 FUNCTION alnrel (X)
3C***BEGIN PROLOGUE ALNREL
4C***PURPOSE Evaluate ln(1+X) accurate in the sense of relative error.
5C***LIBRARY SLATEC (FNLIB)
6C***CATEGORY C4B
7C***TYPE SINGLE PRECISION (ALNREL-S, DLNREL-D, CLNREL-C)
8C***KEYWORDS ELEMENTARY FUNCTIONS, FNLIB, LOGARITHM
9C***AUTHOR Fullerton, W., (LANL)
10C***DESCRIPTION
11C
12C ALNREL(X) evaluates ln(1+X) accurately in the sense of relative
13C error when X is very small. This routine must be used to
14C maintain relative error accuracy whenever X is small and
15C accurately known.
16C
17C Series for ALNR on the interval -3.75000D-01 to 3.75000D-01
18C with weighted error 1.93E-17
19C log weighted error 16.72
20C significant figures required 16.44
21C decimal places required 17.40
22C
23C***REFERENCES (NONE)
24C***ROUTINES CALLED CSEVL, INITS, R1MACH, XERMSG
25C***REVISION HISTORY (YYMMDD)
26C 770401 DATE WRITTEN
27C 890531 Changed all specific intrinsics to generic. (WRB)
28C 890531 REVISION DATE from Version 3.2
29C 891214 Prologue converted to Version 4.0 format. (BAB)
30C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
31C 900326 Removed duplicate information from DESCRIPTION section.
32C (WRB)
33C***END PROLOGUE ALNREL
34 dimension alnrcs(23)
35 LOGICAL first
36 SAVE alnrcs, nlnrel, xmin, first
37 DATA alnrcs( 1) / 1.0378693562 743770e0 /
38 DATA alnrcs( 2) / -.1336430150 4908918e0 /
39 DATA alnrcs( 3) / .0194082491 35520563e0 /
40 DATA alnrcs( 4) / -.0030107551 12753577e0 /
41 DATA alnrcs( 5) / .0004869461 47971548e0 /
42 DATA alnrcs( 6) / -.0000810548 81893175e0 /
43 DATA alnrcs( 7) / .0000137788 47799559e0 /
44 DATA alnrcs( 8) / -.0000023802 21089435e0 /
45 DATA alnrcs( 9) / .0000004164 04162138e0 /
46 DATA alnrcs(10) / -.0000000735 95828378e0 /
47 DATA alnrcs(11) / .0000000131 17611876e0 /
48 DATA alnrcs(12) / -.0000000023 54670931e0 /
49 DATA alnrcs(13) / .0000000004 25227732e0 /
50 DATA alnrcs(14) / -.0000000000 77190894e0 /
51 DATA alnrcs(15) / .0000000000 14075746e0 /
52 DATA alnrcs(16) / -.0000000000 02576907e0 /
53 DATA alnrcs(17) / .0000000000 00473424e0 /
54 DATA alnrcs(18) / -.0000000000 00087249e0 /
55 DATA alnrcs(19) / .0000000000 00016124e0 /
56 DATA alnrcs(20) / -.0000000000 00002987e0 /
57 DATA alnrcs(21) / .0000000000 00000554e0 /
58 DATA alnrcs(22) / -.0000000000 00000103e0 /
59 DATA alnrcs(23) / .0000000000 00000019e0 /
60 DATA first /.true./
61C***FIRST EXECUTABLE STATEMENT ALNREL
62 IF (first) THEN
63 nlnrel = inits(alnrcs, 23, 0.1*r1mach(3))
64 xmin = -1.0 + sqrt(r1mach(4))
65 ENDIF
66 first = .false.
67C
68 IF (x .LE. (-1.0)) CALL xermsg ('SLATEC', 'ALNREL', 'X IS LE -1',
69 + 2, 2)
70 IF (x .LT. xmin) CALL xermsg ('SLATEC', 'ALNREL',
71 + 'ANSWER LT HALF PRECISION BECAUSE X TOO NEAR -1', 1, 1)
72C
73 IF (abs(x).LE.0.375) alnrel = x*(1. -
74 1 x*csevl(x/.375, alnrcs, nlnrel))
75 IF (abs(x).GT.0.375) alnrel = log(1.0+x)
76C
77 RETURN
78 END
function alnrel(x)
Definition alnrel.f:3
function csevl(x, cs, n)
Definition csevl.f:3
function inits(os, nos, eta)
Definition inits.f:3
octave_int< T > xmin(const octave_int< T > &x, const octave_int< T > &y)
real function r1mach(i)
Definition r1mach.f:23
subroutine xermsg(librar, subrou, messg, nerr, level)
Definition xermsg.f:3