id summary reporter owner description type status milestone component version severity resolution keywords cc 10985 Logically dead code; dubious source code comment / inverted if condition? Jonas Maaskola John Maddock "Static code analysis with Coverity pointed me to some dead code in the function ibeta_imp in boost/math/special_functions/beta.hpp. My system's boost library is 1.55.0, but the issue is present identically in boost 1.57. In a block guarded by {{{ if (normalised) { }}} there is the following line (number 1224): {{{ fract -= (normalised ? 1 : boost::math::beta(a, b, pol)); }}} Clearly, normalised has to be true due to the if guard thus the second part (boost::math::beta(a, b, pos)) will never be used. Furthermore, it may be that the if guard's condition is missing a negation for which there are two indications: * in the vicinity (i.e. in the function ibeta_imp) most other if statements (6 of 7) that involve normalised check if normalised is not set (i.e. ""if(!normalised)""), and * more importantly, the first comment in that block on lines 1211-1213 reads: {{{ 1209: else if(normalised) 1210: { 1211: // the formula here for the non-normalised case is tricky to figure 1212: // out (for me!!), and requires two pochhammer calculations rather 1213: // than one, so leave it for now.... }}} I apologize for my limited understanding of the details of the code, which precludes me from proposing a fix, but something seems fishy here! Finally, the line subsequent to the one with the dead code, i.e. line 1225, contains a commented-out alternative. This indicates to me that this entire block may not have been fully satisfactory to the original author(s)." Bugs closed To Be Determined math Boost 1.57.0 Problem fixed