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
dacosh.f
Go to the documentation of this file.
1 *DECK DACOSH
2  DOUBLE PRECISION FUNCTION dacosh (X)
3 C***BEGIN PROLOGUE DACOSH
4 C***PURPOSE Compute the arc hyperbolic cosine.
5 C***LIBRARY SLATEC (FNLIB)
6 C***CATEGORY C4C
7 C***TYPE DOUBLE PRECISION (ACOSH-S, DACOSH-D, CACOSH-C)
8 C***KEYWORDS ACOSH, ARC HYPERBOLIC COSINE, ELEMENTARY FUNCTIONS, FNLIB,
9 C INVERSE HYPERBOLIC COSINE
10 C***AUTHOR Fullerton, W., (LANL)
11 C***DESCRIPTION
12 C
13 C DACOSH(X) calculates the double precision arc hyperbolic cosine for
14 C double precision argument X. The result is returned on the
15 C positive branch.
16 C
17 C***REFERENCES (NONE)
18 C***ROUTINES CALLED D1MACH, XERMSG
19 C***REVISION HISTORY (YYMMDD)
20 C 770601 DATE WRITTEN
21 C 890531 Changed all specific intrinsics to generic. (WRB)
22 C 890531 REVISION DATE from Version 3.2
23 C 891214 Prologue converted to Version 4.0 format. (BAB)
24 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
25 C***END PROLOGUE DACOSH
26  DOUBLE PRECISION x, dln2, xmax, d1mach
27  SAVE dln2, xmax
28  DATA dln2 / 0.6931471805 5994530941 7232121458 18 d0 /
29  DATA xmax / 0.d0 /
30 C***FIRST EXECUTABLE STATEMENT DACOSH
31  IF (xmax.EQ.0.d0) xmax = 1.0d0/sqrt(d1mach(3))
32 C
33  IF (x .LT. 1.d0) CALL xermsg('SLATEC', 'DACOSH',
34  + 'X LESS THAN 1', 1, 2)
35 C
36  IF (x.LT.xmax) dacosh = log(x+sqrt(x*x-1.0d0))
37  IF (x.GE.xmax) dacosh = dln2 + log(x)
38 C
39  RETURN
40  END