boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
315 stars 73 forks source link

Summation of flow bins #281

Closed henryiii closed 4 years ago

henryiii commented 4 years ago

The latest change in develop has broken summation of flow bins. Here's a test that now fails (can be added to histogram_operators_test.cpp):

 // Overflow addition
 {
     auto a = make(Tag(), axis::integer<int, use_default, decltype(axis::option::underflow | axis::option::overflow)>(0, 3));
     auto b = a;

     a(-5);
     b(12);

     // Passes
     BOOST_TEST_EQ(a.at(-1), 1);
     BOOST_TEST_EQ(b.at(3), 1);

     auto c = a + b;
     BOOST_TEST_EQ(c.at(-1), 1); /* Fail: 1 != 0 */
     BOOST_TEST_EQ(c.at(3), 1); /* Fail: 1 != 0 */
}

(I assume you will add a better, more comprehensive test, but I'm happy to make a PR if you want this exact one).

HDembinski commented 4 years ago

Thanks, I am really surprised a) that this happens b) that this was not already covered by my unit tests. No need for a PR, when I fix this I am going to write a test and I write to integrate this check of flow bins into the existing tests.

HDembinski commented 4 years ago

This is fixed, right?

henryiii commented 4 years ago

Yes, perfectly, I'm already using it - sorry for forgetting to close!