code 34343;
procedure COMSQRT(AR,AI,PR,PI);
value AR,AI; real AR,AI,PR,PI;
if AR=0 & AI= 0 then PR:= PI:=0 else 
begin real BR,BI,H;
BR:= ABS(AR); BI:= ABS(AI);
H:= if BI < BR then 
(if BR<1 then SQRT((SQRT((BI/BR)**2+1)*.5+.5)*BR)
else SQRT((SQRT((BI/BR)**2+1)*.125+.125)*BR)*2)
else if BI<1 then SQRT((SQRT((BR/BI)**2+1)*BI+BR)*2)*.5
else if BR+1= 1 then SQRT(BI*.5)
else SQRT(SQRT((BR/BI)**2+1)*BI*.125+BR*.125)*2;
if AR >= 0 then 
begin PR:= H; PI:= AI/H*.5 end 
else begin PI:= if AI >= 0 then H else -H;
PR:= BI/H*.5
end 
end COMSQRT;
        eop