Skip to content

Incorrect Definition : Histogram - histogram_bin_0-100 #38

@aswinkumar1999

Description

@aswinkumar1999

The definition states, "Vector x contains values between 0 and 100, inclusive."

However, the baseline code does not consider the inclusive case for the integer 100, as that would be undefined behavior.

void NO_INLINE correctBinsBy10Count(std::vector<double> const& x, std::array<size_t, 10> &bins) {
  for (size_t i = 0; i < x.size(); i += 1) {
     const size_t bin = x[i] / 10;
     bins[bin] += 1;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions