[R-pkg-devel] How to get arbitrary precise inputs from R for an Rcpp package?
Vladimir Dergachev
vo|ody@ @end|ng |rom m|nd@pr|ng@com
Fri Jul 19 00:11:53 CEST 2024
I see there are existing extended precision packages: Ryacas and Rmpfr,
you might want to take a look at them and their representation of numbers
with higher precision than a double.
best
Vladimir Dergachev
On Fri, 19 Jul 2024, Khue Tran wrote:
> Hi,
>
> I am trying to create an Rcpp package that involves arbitrary precise
> calculations. The function to calculate e^x below with 100 digits precision
> works well with integers, but for decimals, since the input is a double,
> the result differs a lot from the arbitrary precise result I got on
> Wolfram.
>
> I understand the results are different since 0.1 cannot be represented
> precisely in binary with limited bits. It is possible to enter 1 then 10
> and get the multiprecision division of these two integers to attain a more
> precise 0.1 in C++, but this method won't work on a large scale. Thus, I am
> looking for a general solution to get more precise inputs?
More information about the R-package-devel
mailing list