Off[General::spell1];
Clear[Bisection,f0,a0,b0,delta,x];
Bisection[f0_,a0_,b0_,delta_,d_] :=
Module[{a,b,c,Ya,Yb,Yc,f,k,cond,MaxIter}, 
  Set@@{f[x_],f0};
  a = N[a0,d ];
  b = N[b0,d ];
  k = 0;
  Ya = f[a];
  Yb = f[b];
  dx  = b - a;
  cond = 0;
  MaxIter = 1 + Floor[(Log[dx]-
          Log[delta])/Log[2.0]]//N; 
  Print["\t","\t     a = ",N[a,d]];
  Print["\t","\t     b = ",N[b,d]];
  While[cond==0 && k < MaxIter,
    c  = (a+b)/2;
    Yc = f[c];
    Print["k = ",k,"\t    c = ",N[c,d],
              "\t  |dc| <= ",N[dx,d]];
    If[Yc==0, a=c; b=c; 
           cond= PerfectZero];
    If[Yb Yc>0, b=c;Yb=Yc, a=c;Ya=Yc];
    dx = b-a;
    k = k+1; ];
    ]; 
On[General::spell1];

Clear[f,x]; 
f[x_] = x Sin[x] - 1 ;
Print["The function is f[x] = ",f[x]]; 
Plot[f[x],{x,0,2},
PlotLabel->"The curve y = f(x)."];

Bisection[f[x],0,2,10^-10,8]

Clear[f,x]; 
f[x_] = x^3 - 12 x^2 + 3 x +1;
Print["The function is f[x] = ",f[x]]; 
Plot[f[x],{x,-2,2},
PlotLabel->"The curve y = f(x)."];

Bisection[f[x],0,1,10^-5,8]

Clear[f,x]; 
f[x_] = x^4 - 5 x^2 + 2 x +1;
Print["The function is f[x] = ",f[x]]; 
Plot[f[x],{x,-2,2},
PlotLabel->"The curve y = f(x)."];

Bisection[f[x],-2,2,10^-5,8]