Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6367 closed Bugs (fixed)

new 'Added new series evaluation methods to the cyclic Bessel I, J, K and Y functions'-code leads to overflow errors with gcc 4.1.2

Reported by: t.hisch@… Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

This simple code works with boost 1.47 but generates an overflow error with boost 1:47 when compiled with gcc-4.1.2

./a.out terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::overflow_error> >'

what(): Error in function boost::math::bessel_yn<e>(e,e): Overflow Error

cyl_hankel1: -25 8 Aborted

#include <boost/math/special_functions.hpp>                                                                                                                             
                                                                                                    
// Define outgoing Hankel 1 function and its derivative                                             
template <class T1, class T2>                                                                       
inline typename std::complex<double> cyl_hankel1(T1 v, T2 x)                                        
{                                                                                                   
    using namespace boost::math::policies;                                                          
    using namespace boost::math;                                                                    
                                                                                                    
    return std::complex<double>(boost::math::cyl_bessel_j(v, x), boost::math::cyl_neumann(v, x));   
}                                                                                                   
                                                                                                    
int main(void){                                                                                     
    using namespace std;                                                                            
    double r=1.0;                                                                                   
    double k=8.0;                                                                                   
    int nft_ = -25;                                                                                 
                                                                                                    
    cout << "cyl_hankel1: " << nft_ << " " << k*r << " ";                                           
    cout << abs(imag(cyl_hankel1(nft_,k*r))) << endl;                                               
    return 0;                                                                                       
  }         

Change History (5)

comment:1 by t.hisch@…, 11 years ago

Sry for the Typo. It should be: "This simple code works with boost 1.47 but generates an overflow error with boost 1.48 when compiled with gcc-4.1.2"

comment:2 by John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [76373]) Correct overflow logic in Bessel Y and add new test case. Fixes #6367.

comment:3 by John Maddock, 11 years ago

(In [76377]) Document Bessel function fix. Update TODO list. Regenerate docs. Refs #6367.

comment:4 by t.hisch@…, 11 years ago

Thx, this seems to work!

comment:5 by John Maddock, 11 years ago

(In [76445]) Merge fix for #6367. Refs #6367.

Note: See TracTickets for help on using tickets.