Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[x,dlgam,sgngam]=dlgams(x,dlgam,sgngam);
function [x,dlgam,sgngam]=dlgams(x,dlgam,sgngam);
persistent intmlv ; 

if isempty(intmlv), intmlv=0; end;
%***BEGIN PROLOGUE  DLGAMS
%***PURPOSE  Compute the logarithm of the absolute value of the Gamma
%            function.
%***LIBRARY   SLATEC (FNLIB)
%***CATEGORY  C7A
%***TYPE      doubleprecision (ALGAMS-S, DLGAMS-D)
%***KEYWORDS  ABSOLUTE VALUE OF THE LOGARITHM OF THE GAMMA FUNCTION,
%             FNLIB, SPECIAL FUNCTIONS
%***AUTHOR  Fullerton, W., (LANL)
%***DESCRIPTION
%
% DLGAMS(X,DLGAM,SGNGAM) calculates the doubleprecision natural
% logarithm of the absolute value of the Gamma function for
% doubleprecision argument X and stores the result in double
% precision argument DLGAM.
%
%***REFERENCES  (NONE)
%***ROUTINES CALLED  DLNGAM
%***REVISION HISTORY  (YYMMDD)
%   770701  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)
%***end PROLOGUE  DLGAMS
%***FIRST EXECUTABLE STATEMENT  DLGAMS
[dlgam ,x]=dlngam(x);
sgngam = 1.0d0;
if( x>0.0d0 )
return;
end;
%
intmlv = rem(-fix(x),2.0d0) + 0.1d0;
if( intmlv==0 )
sgngam = -1.0d0;
end;
%
end
%DECK DLI

Contact us at files@mathworks.com