I'm exercising hypergeometric_pFq with this code:
#include <string>
#include <iostream>
#include <iomanip>
#include <boost/math/special_functions/hypergeometric_pFq.hpp>
using namespace boost::math;
int main(int argc, char *argv[])
{
if (argc != 4 ) {
printf("use: hyppfq a b x\n");
return -1;
}
double a = std::stod(argv[1]);
double b = std::stod(argv[2]);
double x = std::stod(argv[3]);
double y = hypergeometric_pFq({a}, {b}, x);
std::cout << "pFq = " << std::scientific << std::setw(25)
<< std::setprecision(17) << y << std::endl;
return 0;
}
Normal case:
$ ./hyppfq 2 3 10.0
pFq = 3.96478384306520911e+03
Overflow exception (working as expected):
$ ./hyppfq 2 3 10000.0
terminate called after throwing an instance of 'std::overflow_error'
what(): Error in function boost::math::hypergeometric_pFq<double>(double,double,double): numeric overflow
Aborted (core dumped)
When the third argument is much larger, the exception boost::math::rounding_error is thrown when the code attempts to convert something to an integer:
$ ./hyppfq 2 3 10000000000.0
terminate called after throwing an instance of 'boost::math::rounding_error'
what(): Error in function boost::math::itrunc<long double>(long double): Value 9999999999 can not be represented in the target integer type.
I would expect this case to throw std::overflow_error as in the previous example.
I'm exercising
hypergeometric_pFqwith this code:Normal case:
Overflow exception (working as expected):
When the third argument is much larger, the exception
boost::math::rounding_erroris thrown when the code attempts to convert something to an integer:I would expect this case to throw
std::overflow_erroras in the previous example.