function [dacoshresult,x]=dacosh(x);
dacoshresult=[];
persistent dln2 firstCall xmax ; if isempty(firstCall),firstCall=1;end;
;
%***BEGIN PROLOGUE DACOSH
%***PURPOSE Compute the arc hyperbolic cosine.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C4C
%***TYPE doubleprecision (ACOSH-S, DACOSH-D, CACOSH-C)
%***KEYWORDS ACOSH, ARC HYPERBOLIC COSINE, ELEMENTARY FUNCTIONS, FNLIB,
% INVERSE HYPERBOLIC COSINE
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% DACOSH(X) calculates the doubleprecision arc hyperbolic cosine for
% doubleprecision argument X. The result is returned on the
% positive branch.
%
%***REFERENCES (NONE)
%***ROUTINES CALLED D1MACH, XERMSG
%***REVISION HISTORY (YYMMDD)
% 770601 DATE WRITTEN
% 890531 Changed all specific intrinsics to generic. (WRB)
% 890531 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
%***end PROLOGUE DACOSH
if isempty(dln2), dln2=0; end;
if isempty(xmax), xmax=0; end;
if firstCall, dln2=[0.69314718055994530941723212145818d0]; end;
if firstCall, xmax=[0.0d0]; end;
firstCall=0;
%***FIRST EXECUTABLE STATEMENT DACOSH
if( xmax==0.0d0 )
xmax = 1.0d0./sqrt(d1mach(3));
end;
%
if( x<1.0D0 )
xermsg('SLATEC','DACOSH','X LESS THAN 1',1,2);
end;
%
if( x<xmax )
dacoshresult = log(x+sqrt(x.*x-1.0d0));
end;
if( x>=xmax )
dacoshresult = dln2 + log(x);
end;
%
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
end
%DECK DAIE