Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-5432

Possible rounding bug in THashTable::AverageCollisions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.34/00
    • Fix Version/s: 6.14/00
    • Component/s: Core Libraries
    • Labels:
      None
    • Environment:

      Any

      Description

      This line in THashTable::AverageCollisions may be casting wrongly:
      return ((Float_t)fEntries)/fUsedSlots;

      fUsedSlots is an Int_t, and the compiler warning suggests that the entire thing may be made an Int_t during the division:

      /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.09-x86_64-slc5-gcc4.3/include/THashTable.h: In member function ¿Float_t THashTable::AverageCollisions() const¿:
      /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.09-x86_64-slc5-gcc4.3/include/THashTable.h:85: warning: conversion to ¿Float_t¿ from ¿int¿ may alter its value

      The line should be changed to read:
      return ((Float_t)fEntries)/((Float_t)fUsedSlots);

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            dgeerts Daniel Geerts
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: