[R] Error of exp() in a dll from Fortran

From: Hao Ren Sr <renhao_at_msu.edu>
Date: Sat, 12 Jul 2008 03:56:10 -0400


Hi,

I have an error happened when I use exp() in my Fortran code. My Fortran code is

     SUBROUTINE f(n,c)         

	    REAL, INTENT(IN) :: n(10)
	    REAL, INTENT(OUT) :: c(10)
	    INTEGER :: k
	
	    DO k=1, 10
	       c(k) = exp( n(k) )
	    END DO
     END 

I compiled the fortran code as a dll

 Rcmd SHLIB -o f.dll f.f -L -lacml

Then I loaded the dll file to R, and try some number

> dyn.load("C:/Program Files/R/R-2.7.1/bin/code/f.dll")
> .Fortran("f",as.real(c(1:10)),A=real(10))
[[1]]
[1] 1 2 3 4 5 6 7 8 9 10

$A

[1]  17066.21  58265.20 179948.41 390001.06 576529.12      0.00      0.00
[8]      0.00      0.00      0.00 

I tried to figur out what happened, but confused. Any suggestion? Thanks

Hao Ren



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 12 Jul 2008 - 09:52:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 12 Jul 2008 - 11:31:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive