GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
asinh.f
Go to the documentation of this file.
1 *DECK ASINH
2  FUNCTION asinh (X)
3 C***BEGIN PROLOGUE ASINH
4 C***PURPOSE Compute the arc hyperbolic sine.
5 C***LIBRARY SLATEC (FNLIB)
6 C***CATEGORY C4C
7 C***TYPE SINGLE PRECISION (ASINH-S, DASINH-D, CASINH-C)
8 C***KEYWORDS ARC HYPERBOLIC SINE, ASINH, ELEMENTARY FUNCTIONS, FNLIB,
9 C INVERSE HYPERBOLIC SINE
10 C***AUTHOR Fullerton, W., (LANL)
11 C***DESCRIPTION
12 C
13 C ASINH(X) computes the arc hyperbolic sine of X.
14 C
15 C Series for ASNH on the interval 0. to 1.00000D+00
16 C with weighted error 2.19E-17
17 C log weighted error 16.66
18 C significant figures required 15.60
19 C decimal places required 17.31
20 C
21 C***REFERENCES (NONE)
22 C***ROUTINES CALLED CSEVL, INITS, R1MACH
23 C***REVISION HISTORY (YYMMDD)
24 C 770401 DATE WRITTEN
25 C 890531 Changed all specific intrinsics to generic. (WRB)
26 C 890531 REVISION DATE from Version 3.2
27 C 891214 Prologue converted to Version 4.0 format. (BAB)
28 C***END PROLOGUE ASINH
29  dimension asnhcs(20)
30  LOGICAL first
31  SAVE aln2, asnhcs, nterms, xmax, sqeps, first
32  DATA aln2 /0.6931471805 5994530942e0/
33  DATA asnhcs( 1) / -.1282003991 1738186e0 /
34  DATA asnhcs( 2) / -.0588117611 89951768e0 /
35  DATA asnhcs( 3) / .0047274654 32212481e0 /
36  DATA asnhcs( 4) / -.0004938363 16265361e0 /
37  DATA asnhcs( 5) / .0000585062 07058557e0 /
38  DATA asnhcs( 6) / -.0000074669 98328931e0 /
39  DATA asnhcs( 7) / .0000010011 69358355e0 /
40  DATA asnhcs( 8) / -.0000001390 35438587e0 /
41  DATA asnhcs( 9) / .0000000198 23169483e0 /
42  DATA asnhcs(10) / -.0000000028 84746841e0 /
43  DATA asnhcs(11) / .0000000004 26729654e0 /
44  DATA asnhcs(12) / -.0000000000 63976084e0 /
45  DATA asnhcs(13) / .0000000000 09699168e0 /
46  DATA asnhcs(14) / -.0000000000 01484427e0 /
47  DATA asnhcs(15) / .0000000000 00229037e0 /
48  DATA asnhcs(16) / -.0000000000 00035588e0 /
49  DATA asnhcs(17) / .0000000000 00005563e0 /
50  DATA asnhcs(18) / -.0000000000 00000874e0 /
51  DATA asnhcs(19) / .0000000000 00000138e0 /
52  DATA asnhcs(20) / -.0000000000 00000021e0 /
53  DATA first /.true./
54 C***FIRST EXECUTABLE STATEMENT ASINH
55  IF (first) THEN
56  nterms = inits(asnhcs, 20, 0.1*r1mach(3))
57  sqeps = sqrt(r1mach(3))
58  xmax = 1.0/sqeps
59  ENDIF
60  first = .false.
61 C
62  y = abs(x)
63  IF (y.GT.1.0) go to 20
64 C
65  asinh = x
66  IF (y.GT.sqeps) asinh = x*(1.0 + csevl(2.*x*x-1., asnhcs,nterms))
67  RETURN
68 C
69  20 IF (y.LT.xmax) asinh = log(y + sqrt(y**2+1.))
70  IF (y.GE.xmax) asinh = aln2 + log(y)
71  asinh = sign(asinh, x)
72 C
73  RETURN
74  END