function [res]=logsum(p1,p2)
p1=abs(p1)+eps;
p2=abs(p2)+eps;
%logsum(p1+p2) is computed
if (p1>p2)
    x=log(p1)-log(p2);
    res=log(p1)+log(2)/(1+0.4*x+0.97*(x^2));
else
    x=log(p2)-log(p1);
    res=log(p2)+log(2)/(1+0.4*x+0.97*(x^2));
end
res=abs(res);