Project

General

Profile

Bug #17095

Floating point divide by zero in ClusterParamsAlg::RefineDirection

Added by Thomas Junk over 2 years ago. Updated over 2 years ago.

Status:
Assigned
Priority:
Normal
Assignee:
Category:
Reconstruction
Target version:
-
Start date:
06/30/2017
Due date:
% Done:

0%

Estimated time:
Occurs In:
Experiment:
-
Co-Assignees:
Duration:

Description

There's a 0/0 hazard in ClusterParamsAlg::RefineDirection where cosangle_start is zero
(endStartDiff_x and endStartDiff_y are both zero in the example I found). Propose wrapping
a test on the numerator because it's easier to test. It looks like you get a zero denominator only
when the numerator is zero.

      double cosangle_start = (endStartDiff_x*hitStartDiff_x + 
                               endStartDiff_y*hitStartDiff_y);
      if (cosangle_start != 0)  // protect against divide by zero
    {
           cosangle_start /= ( pow(pow(endStartDiff_x,2)+pow(endStartDiff_y,2),0.5)
                              * pow(pow(hitStartDiff_x,2)+pow(hitStartDiff_y,2),0.5));
    }

Related issues

Blocks LArSoft - Necessary Maintenance #17047: Floating Point ExceptionsAssigned06/27/2017

History

#1 Updated by Thomas Junk over 2 years ago

Oh, and same thing with the calculation of cosangle_end

#2 Updated by Thomas Junk over 2 years ago

And why so many pow(,2)'s in there? Wouldn't multiplies be faster? And std::sqrt instead
of pow(,0.5)?

#3 Updated by Gianluca Petrillo over 2 years ago

#4 Updated by Lynn Garren over 2 years ago

  • Category set to Reconstruction
  • Status changed from New to Assigned
  • Assignee set to Andrzej Szelc

Andrzej, would you please have a look?



Also available in: Atom PDF