function [gamrresult,x]=gamr(x);
gamrresult=[];
persistent alngx gamr irold sgngx ;
if isempty(alngx), alngx=0; end;
if isempty(gamrresult), gamrresult=0; end;
if isempty(sgngx), sgngx=0; end;
if isempty(irold), irold=0; end;
%***BEGIN PROLOGUE GAMR
%***PURPOSE Compute the reciprocal of the Gamma function.
%***LIBRARY SLATEC (FNLIB)
%***CATEGORY C7A
%***TYPE SINGLE PRECISION (GAMR-S, DGAMR-D, CGAMR-C)
%***KEYWORDS FNLIB, RECIPROCAL GAMMA FUNCTION, SPECIAL FUNCTIONS
%***AUTHOR Fullerton, W., (LANL)
%***DESCRIPTION
%
% GAMR is a single precision function that evaluates the reciprocal
% of the gamma function for single precision argument X.
%
%***REFERENCES (NONE)
%***ROUTINES CALLED ALGAMS, GAMMA, XERCLR, XGETF, XSETF
%***REVISION HISTORY (YYMMDD)
% 770701 DATE WRITTEN
% 861211 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 900727 Added EXTERNAL statement. (WRB)
%***end PROLOGUE GAMR
%***FIRST EXECUTABLE STATEMENT GAMR
gamrresult = 0.0;
if( x<=0.0 && fix(x)==x )
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
end;
%
[irold]=xgetf(irold);
xsetf(1);
if( abs(x)>10.0 )
%
[x,alngx,sgngx]=algams(x,alngx,sgngx);
xerclr;
[irold]=xsetf(irold);
gamrresult = sgngx.*exp(-alngx);
else;
gamrresult = 1.0./gamma(x);
xerclr;
[irold]=xsetf(irold);
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',x); evalin('caller',[inputname(1),'=FUntemp;']); end
return;
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 GAMRN