@@ -280,10 +280,18 @@ void TAxis::ExecuteEvent(Int_t event, Int_t px, Int_t py)
280
280
}
281
281
282
282
// //////////////////////////////////////////////////////////////////////////////
283
- // / Find bin number corresponding to abscissa x . NOTE: this method does not work with alphanumeric bins !!!
283
+ // / Find bin number corresponding to abscissa `x` . NOTE: this method does not work with alphanumeric bins !!!
284
284
// /
285
- // / If x is underflow or overflow, attempt to extend the axis if TAxis::kCanExtend is true.
286
- // / Otherwise, return 0 or fNbins+1.
285
+ // / If `x` is underflow or overflow, attempt to extend the axis if TAxis::kCanExtend is true.
286
+ // / Otherwise, return `0` or `fNbins+1`.
287
+ // /
288
+ // / @note The underflow bin (`0`) is for any `x` strictly smaller than `fXmin`,
289
+ // / whereas the overflow bin (`nbins+1`) is for any `x` greater or equal than `fXmax`,
290
+ // / as well as for `NaN`. The first regular bin (`1`) is for any `x`
291
+ // / greater or equal than `fXmin` and strictly smaller than `fXmin + binwidth`, and so on.
292
+ // / @note The bin assignment equation uses doubles, thus rounding errors are
293
+ // / expected to appear at the edges. For example: `TAxis(1, -1., 0.).FindBin(-1e-17)`
294
+ // / returns the overflow bin (`2`) rather than the theoretically correct bin (`1`).
287
295
288
296
Int_t TAxis::FindBin (Double_t x)
289
297
{
@@ -406,17 +414,18 @@ Int_t TAxis::FindFixBin(const char *label) const
406
414
407
415
408
416
// //////////////////////////////////////////////////////////////////////////////
409
- // / Find bin number corresponding to abscissa x
417
+ // / Find bin number corresponding to abscissa `x`
410
418
// /
411
- // / Identical to TAxis::FindBin except that if x is an underflow/overflow
419
+ // / Identical to TAxis::FindBin except that if `x` is an underflow/overflow
412
420
// / no attempt is made to extend the axis.
421
+ // / @see TAxis::FindBin
413
422
414
423
Int_t TAxis::FindFixBin (Double_t x) const
415
424
{
416
425
Int_t bin;
417
426
if (x < fXmin ) { // *-* underflow
418
427
bin = 0 ;
419
- } else if ( !(x < fXmax )) { // *-* overflow (note the way to catch NaN
428
+ } else if ( !(x < fXmax )) { // *-* overflow (note the way to catch NaN)
420
429
bin = fNbins +1 ;
421
430
} else {
422
431
if (!fXbins .fN ) { // *-* fix bins
0 commit comments