[Home]
[Chapter]
[Contents]
[Previous Algorithm]
[Next Algorithm]


General interpolation formula


function phi( key : typekey; lo, up : integer ) : integer; var i : integer; begin i := trunc( (key-MinKey) * (up-lo+1.0) / (MaxKey-MinKey) ) + lo; phi := i; if i>up then phi := up else if i<lo then phi := lo end;

C source (41.phi.c) Pascal source (41.phi.p)



© Addison-Wesley Publishing Co. Inc.