Ticket #7391 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Bug in workspace bin comparisons

Reported by: Russell Taylor Owned by: Russell Taylor
Priority: major Milestone: Release 2.6
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description

There's a bug in line 403 of WorkspaceOpOverloads.cpp:

else if ( std::abs(commonSum-sum)/std::max<double>(commonSum,sum) > 1.0E-7 ) return false;

In the case where both commonSum & sum are negative, the comparison will always fail. There are a couple of other places in the same file that also have this problem.

This bug has been there for years, but was spotted while investigating #3390.

Change History

comment:1 Changed 7 years ago by Russell Taylor

  • Status changed from new to accepted

comment:2 Changed 7 years ago by Russell Taylor

Re #7391. Add tests for negative bin boundaries sum bug.

Changeset: ffb76371d755366fcca43a56e3f09ef69d8f7587

comment:3 Changed 7 years ago by Russell Taylor

Re #7391. Take absolute value of sum of bin boundaries.

This fixes a bug if the sum of the bin boundaries is negative (in which case the tests would always evaluate to false).

Changeset: 9811ef92aa72f3db27239ddb9c5131d33729ed9a

comment:4 Changed 7 years ago by Russell Taylor

Re #7391. Change tab indentation to spaces. No code changed.

Changeset: f5dac7c2e1e48453548aaf1be3b4dba08bf503e2

comment:5 Changed 7 years ago by Russell Taylor

  • Status changed from accepted to verify
  • Resolution set to fixed

Test by inspecting the code and the tests. Branch is bugfix/7391_bin_commonality.

When wanting to add a test case for this bug, I realised that there were no unit tests at all for the code in this file - #7392 is concerned with that.

comment:6 Changed 7 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:7 Changed 7 years ago by Owen Arnold

  • Status changed from verifying to closed

Code changes look sensible. Unit tests put in place to cover functionality. Unit tests passing and executing quickly on the develop branch.

comment:8 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8237

Note: See TracTickets for help on using tickets.