Opened 9 years ago

Closed 9 years ago

#9512 closed Bugs (fixed)

trivial bug: sign change for negative values in bessel_i1

Reported by: Cornelia Strauß <strauss@…> Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

The function bessel_i1() in boost/math/special_functions/detail/bessel_i1.hpp ends with the following code:

if (x < 0)
{
    value *= -value;                 // odd function
}
return value;

Instead of taking the square root, only the sign of value should be changed:

if (x < 0)
{
    value *= -1;                 // odd function
}
return value;

Change History (1)

comment:1 by John Maddock, 9 years ago

Resolution: fixed
Status: newclosed

Some investigation shows that that is dead code: negative x is handled by the caller of that function. I've removed the offending code and added an assert for x >= 0 instead. Fixed in Git develop.

Note: See TracTickets for help on using tickets.