Re: [Rd] C function, double problem

2012-12-08 Thread Dirk Eddelbuettel
That is great example of why folks should NOT use the .C() interface. Rcpp can help here, __even if you do not use any Rcpp language features__. Below is a showcase for the recent sourceCpp() function which takes a C++ file (shown below), converts it and optionally runs the embedded R code. Think

Re: [Rd] C function, double problem

2012-12-08 Thread Rui Barradas
Hello, The double in R and the double in C are the same type, with the same number of decimals (64 bits), so it's not because the numbers are too long. Try calling .C("function", other parameters, result = double(quantity)). Or maybe the error is in the C code, of which we know nothing about.

[Rd] C function, double problem

2012-12-08 Thread mpietro
Hi everybody, here's my problem: i call a C function which calculates a large number of double values and puts them into an array which is passed from R as a parameter in the function (like .C("function", other parameters, result = as.double( c ( 1 : quantity ) ). When the values come back to