|
it is called repeatedly, with |
|
x taken from an increasing or decrea-
sing sequence. This will happen, e.g., when a pp function is to be
|
graphed. The first guess for |
|
left is therefore taken to be the val-
|
ue returned at the previous call and stored in the |
|
l o c a l varia-
|
ble |
ilo . A first check ascertains that ilo .lt. lxt (this is nec-
essary since the present call may have nothing to do with the previ-
|
ous call). Then, if |
|
xt(ilo) .le. x .lt. xt(ilo+1), we set left =
|
ilo |
and are done after just three comparisons.
|
Otherwise, we repeatedly double the difference | |
istep = ihi - ilo
|
|
|
while also moving |
|
ilo and ihi in the direction of x , until
xt(ilo) .le. x .lt. xt(ihi) ,
after which we use bisection to get, in addition, ilo+1 = ihi .
|
left = ilo |
|
is then returned.
|
|