I want to use boost/multiprecision with Rcpp. Therefore I looked around and found these threads about boost: one and two. The first one about quad-precision is exactly what I want to use. The problem is that I cannot compile the given example. However, I can compile the example from the second thread which just uses a different directory in the boost package. So I'm at a loss as to what is going wrong. Relevant code from the first thread:
// [[Rcpp::depends(BH)]]
#include <Rcpp.h>
#include <boost/multiprecision/float128.hpp>
#include <boost/multiprecision/mpfr.hpp>
namespace mp = boost::multiprecision;
// [[Rcpp::export]]
std::string qexp(double da = -1500.0, double db = -1501.0)
{
mp::float128 a(da), b(db);
mp::float128 res = mp::exp(a) / (mp::exp(a) + mp::exp(b));
return res.convert_to<std::string>();
}
// [[Rcpp::export]]
std::string mpfr_exp(double da = -1500.0, double db = -1501.0)
{
mp::mpf_float_100 a(da), b(db);
mp::mpf_float_100 res = mp::exp(a) / (mp::exp(a) + mp::exp(b));
return res.convert_to<std::string>();
}
The error I get is: ".../R/win-library/3.3/BH/include/boost/multiprecision/gmp.hpp:21:17: fatal error: gmp.h: No such file or directory #include ". But when I browse to: ".../R/win-library/3.3/BH/include/boost/multiprecision/" the file "gmp.hpp" is there. I already tried running "Sys.setenv("PKG_LIBS" = "-lmpfr -lgmp")" as described in the first thread, but no luck. Any suggestions? In case it matters, I'm using windows.