% Compute the reciprocal of a given number w/o division
% Uses Newton-Raphson method
% NewtonReciprocation

a=6.7; pt5=0.5; h=1; one=1;
sgn=sign(a); a=abs(a);
if a < pt5
    isSmall=1; h=1; y=1;
    while a < h
        h=pt5*h, y=2*y; 
    end
elseif a > one
    isSmall=0; h=1; y=1; 
    while a > h
        h=2*h, y=pt5*y, 
    end
else
    h=1;
end
a=a*y, h,
x=pt5*a;

