[Rcpp-devel] Rcpp catching a domain error
Devin
devin.heer at gmail.com
Thu Dec 11 16:03:48 CET 2014
Dear list
My Rcpp source file contains a gsl_sf_hyperg_2F1() function, and for some
input values to this function the return value is "NaN", which leads in
RStudio to an abortion error.
In order to avoid abortion errors, I try to implement a try/catch exception
handler:
// [[Rcpp::depends(RcppGSL)]]
#include <RcppGSL.h>
#include <gsl/gsl_sf_hyperg.h>
#include <Rcpp.h>
#include <math.h>
using namespace Rcpp;
// [[Rcpp::export]]
int test()
{
try{
gsl_sf_hyperg_2F1(1,1,1.1467003,1); // abortion error since not
defined
}
catch(std::domain_error& e){
std::cout << "Domain Error occurred!" << std::endl;
}
return 0;
}
This seems to be wrong, since it still causes an abortion error in RStudio.
I appreciate any input
Thanks
Devin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141211/b98e3c2d/attachment.html>
More information about the Rcpp-devel
mailing list