Bisection Division

BisectionDivision[d0_,a0_,b0_] :=
Module[{},
a=N[a0];
b=N[b0];
d=N[d0];
fa = d*a-1;  
fb =  d*b-1;  
c = a+0.5(b-a); 
fc= d*c-1; 
While[a < c && c<b,
If[ Sign[fa] ==  Sign[fc], 
a = c;fa=fc, 
b = c;fb=fc
];
c = a+0.5(b-a);
fc=d*c-1;
]; 
Return[c]
]

Bivision[a0_,b0_]:=
Module[{},
a=N[a0]; 
b=N[b0];
If[b<0,a=-a;b=-b];
p=1;
tmp=b;
While[tmp<1,tmp=tmp*10;p=p*10];
If[b<1,
Return[a*BisectionDivision[b,1,p]],
Return[a*BisectionDivision[b,0,1]]
]
]

Bivision[1,3]

f[x_]:=Bivision[1,x]
f[2]
Plot[f[x],{x,.001,2}]
Plot[f[x]-1/x,{x,.001,2}]

f[x_]:=Bivision[Cos[x],x]
Plot[{f[x],Cos[x]/x},{x,0,2Pi}]
Plot[{f[x]-Cos[x]/x},{x,0,2Pi}]