function fLb: Real; //Двоичный логарифм var_input X:real; end_var var s:real:=0.0; a:real:=0.5; i:udint; b:real; end_var //PRG if X>0 then if X>=1 then b:=1; X:=X; else b:=-1; X:=1/X; end_if if x>2 then s:=udint_to_real( cd32(real_to_udint(x))); X:=X/ pow(2,s); end_if; for i:=0 to 16 do x:=x*x; if x>2 then x:=x/2; s:=s+a; end_if; a:=a*0.5; end_for fLb:=s*b; end_if end_function