Ignore:
Timestamp:
Mar 3, 2010, 7:10:36 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
bc46c1
Parents:
f78203
git-author:
Frederik Heber <heber@…> (03/03/10 18:41:03)
git-committer:
Frederik Heber <heber@…> (03/03/10 19:10:36)
Message:

BUGFIX: rounding imprecision let values appear twice in BinMap.

  • we fix this by always converting bin to integer and then back to double when putting into map in BinData()
  • GetBin returns integer

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/analysis_correlation.cpp

    rf78203 rdd3a80  
    342342};
    343343
    344 /** Returns the start of the bin for a given value.
     344/** Returns the index of the bin for a given value.
    345345 * \param value value whose bin to look for
    346346 * \param BinWidth width of bin
    347347 * \param BinStart first bin
    348348 */
    349 double GetBin ( const double value, const double BinWidth, const double BinStart )
    350 {
    351   Info FunctionInfo(__func__);
    352   double bin =(double) (floor((value - BinStart)/BinWidth));
    353   return (bin*BinWidth+BinStart);
     349int GetBin ( const double value, const double BinWidth, const double BinStart )
     350{
     351  Info FunctionInfo(__func__);
     352  int bin =(int) (floor((value - BinStart)/BinWidth));
     353  return (bin);
    354354};
    355355
Note: See TracChangeset for help on using the changeset viewer.