Code covered by the BSD License  

Highlights from
slatec

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

[ar,ai,br,bi,cr,ci]=cdiv(ar,ai,br,bi,cr,ci);
function [ar,ai,br,bi,cr,ci]=cdiv(ar,ai,br,bi,cr,ci);
%***BEGIN PROLOGUE  CDIV
%***SUBSIDIARY
%***PURPOSE  Compute the complex quotient of two complex numbers.
%***LIBRARY   SLATEC
%***TYPE      COMPLEX (CDIV-C)
%***AUTHOR  (UNKNOWN)
%***DESCRIPTION
%
%     Complex division, (CR,CI) = (AR,AI)/(BR,BI)
%
%***SEE ALSO  EISDOC
%***ROUTINES CALLED  (NONE)
%***REVISION HISTORY  (YYMMDD)
%   811101  DATE WRITTEN
%   891214  Prologue converted to Version 4.0 format.  (BAB)
%   900402  Added TYPE section.  (WRB)
%***end PROLOGUE  CDIV
%
persistent ais ars bis brs s ; 

if isempty(s), s=0; end;
if isempty(ars), ars=0; end;
if isempty(ais), ais=0; end;
if isempty(brs), brs=0; end;
if isempty(bis), bis=0; end;
%***FIRST EXECUTABLE STATEMENT  CDIV
s = abs(br) + abs(bi);
ars = ar./s;
ais = ai./s;
brs = br./s;
bis = bi./s;
s = brs.^2 + bis.^2;
cr =(ars.*brs+ais.*bis)./s;
ci =(ais.*brs-ars.*bis)./s;
end
%DECK CDNTL

Contact us at files@mathworks.com