VF_searchCVD_searchCVE_searchC
FunctionBinary searches of an ordered table for the entry coming closest to a specified value
Syntax C/C++#include <VFstd.h>
ui VF_searchC( fVector X, ui size, float C, int mode );
C++ VecObj#include <OptiVec.h>
ui vector<T>::searchC( const T& C, int mode );
Pascal/Delphiuses VFstd;
function VF_searchC( X:fVector; size:UIntSize; C:Single; mode:Integer ):UIntSize;
DescriptionIn a binary search, the element of X is located that is closest to the value specified as C. X has to be an ordered table (either ascending or descending); if this condition is not fulfilled, the result will be wrong. If C is outside the range covered by X, the first or the last element of X is chosen, whichever is closer to C. If C is within the range of the table, three modes of the search are available:
mode = +1:find the next element greater than or equal to C
mode =   0:find the element closest to C; if two elements are within equal distance, choose the lower index
mode =  -1:find the next element less than or equal to C
Error handlingnone
Return valueindex of the element found.
See alsoVF_searchV,   VF_sort,   VF_polyinterpol

VectorLib Table of Contents  OptiVec home