Complex Number in R is defined as:
function (length.out = 0L, real = numeric(), imaginary = numeric(), modulus = 1, argument = 0)
I've a program which aims to process multiple precision values in the real case and complex case. R does not support multiple precision directly. After installing the Rmpfr
package I could define multiple precision values and use regular functions using the new mpfr objects
.
TestFunc <- function(a, b){
seq(a, b, length.out = 3)
}
>TestFunc(mpfr(1, 120), mpfr(2, 120))
[1] 1
[2] 1.1666666666666666666666666666666666662
[3] 1.3333333333333333333333333333333333338
[4] 1.5
[5] 1.6666666666666666666666666666666666677
[6] 1.8333333333333333333333333333333333338
[7] 2
I have functions which also process complex numbers.
PROBLEM: I cannot call
complex(real=mpfr(1, 120), imaginary=mpfr(1,120))
because, the complex function definition requires these to be of double precision only.
Is there a way in which I can do complex number arithmetic in R, using multiple precision?