f[x_]:= 2x^2 - 10*Sin[x]+1

Plot[f[x],{x,0,Pi}]

bx[f_,left_,right_]:=
With[{mid=(right+left)/2},
Which[
(* Abs[f[mid]]≤10^-15,mid,*)
(* (right-left)/right≤10^-15,mid,*)
(right-left)≤10^-15,mid,
f[mid]<=0 && f[left]<=0,bx[f,mid,right],
f[mid]<=0 && f[left]>=0,bx[f,left,mid],
f[mid]>=0 && f[left]<=0,bx[f,left,mid],
f[mid]>=0 && f[left]>=0,bx[f,mid,right],
True, Print["error!"]
]
]

x=bx[f,1.,3.]

f[x]

left+(right-left)/2

Simplify[(right+left)/2==left+(right-left)/2]

f2[x_]:= 2 (x-30000)^2 - 10*Sin[x-30000]+1

Plot[f2[x],{x,0+30000,Pi+30000}]

x=bx[f2,1.+30000,3.+30000]

bx[f_,left_,right_]:=
With[{mid=(right+left)/2},
Which[
(* Abs[f[mid]]≤10^-15,mid,*)
(* (right-left)/right≤10^-15,mid,*)
(right-left)≤10^-(15-4),mid,
f[mid]<=0 && f[left]<=0,bx[f,mid,right],
f[mid]<=0 && f[left]>=0,bx[f,left,mid],
f[mid]>=0 && f[left]<=0,bx[f,left,mid],
f[mid]>=0 && f[left]>=0,bx[f,mid,right],
True, Print["error!"]
]
]

x=bx[f2,1.+30000,3.+30000]

f2[x]