I want to apply package mpfr for a function as follows:
f1 =function(x) exp(x)
if for example x = c(-1500, -2000, -6400, -7200)
> x = c(-1500, -2000, -6400, -7200)
> mpfr(f1(x), precBits=64)
4 'mpfr' numbers of precision 64 bits
[1] 0 0 0 0
I would like to get the values of function f1 even if its so small, how can I get it in R?
64 bits is not a whole lot. But primarily, you've made a mistake many of us did: the value of
f1(x)
is already zero because it's calculated before being converted into a bignum.Try it this way: