GNU Scientific Library Reference Manual - Third Edition (v1.12)by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi Paperback (6"x9"), 592 pages, 60 figures ISBN 0954612078 RRP £24.95 ($39.95) |

## 21.5 Searching histogram ranges

The following functions are used by the access and update routines to locate the bin which corresponds to a given x coordinate.

__Function:__int**gsl_histogram_find***(const gsl_histogram **`h`, double`x`, size_t *`i`)- This function finds and sets the index
`i`to the bin number which covers the coordinate`x`in the histogram`h`. The bin is located using a binary search. The search includes an optimization for histograms with uniform range, and will return the correct bin immediately in this case. If`x`is found in the range of the histogram then the function sets the index`i`and returns`GSL_SUCCESS`

. If`x`lies outside the valid range of the histogram then the function returns`GSL_EDOM`

and the error handler is invoked.

ISBN 0954612078 | GNU Scientific Library Reference Manual - Third Edition (v1.12) | See the print edition |