absolute vs. relative distance

alpha=123451234512345123451234512345

fpn=1.234512345123451`*^29

Abs[alpha-fpn]

Abs[fpn-alpha]/alpha

single precision Pi: 3.1415927

(Pi-3.1415927)/Pi

double precision Pi : 3.141592653589793

(Pi-3.141592653589793)/Pi

N[Pi,45]
SetPrecision[Pi,45]

(SetPrecision[Pi,45]-SetPrecision[3.141592653589793,45])/SetPrecision[Pi,45]

why 15 decimal digits?

Log[10,2.^24]

Log[10,2.^53]

bisection

f[x_]:=x^7-x^4-2

Plot[f[x],{x,-1,2}]

bx[left_,right_,g_]:=
With[{mid=(left+right)/2},
Which[
Abs[g[mid]]≤10^-12, mid,
g[left]<0&&g[mid]<0,bx[mid,right,g],
g[left]<0&&g[mid]>0,bx[left,mid,g],
g[left]>0&&g[mid]<0,bx[left,mid,g],
g[left]>0&&g[mid]>0,bx[mid,right,g],
True,Print["oh oh..."]
]
]

bx[-1.,2.,f]

f[bx[-1.,2.,f]]

(left+right)/2==left+(right-left)/2