search for: myroundcall

Displaying 1 result from an estimated 1 matches for "myroundcall".

2010 Mar 29
2
.Call and .C arguments
...se see the two simple examples to understand the issue. # C call from R .C("myroundC",as.double(1204.245)) // C Code void myroundC(double *Amount){ *Amount = Rf_fround(*Amount,2); } #Return value in R [[1]] [1] 1204.24 # C call from R .Call("myroundCall",as.double(1204.245)) // C Code SEXP myroundCall(SEXP a){ double *ap = REAL(a), *ansp; SEXP ans; PROTECT(ans = allocVector(REALSXP, 1)); ansp = REAL(ans); *ansp = Rf_fround(*ap,2); UNPROTECT(1); retu...