tests/testthat/examples/knitr-examples/111-engine-fortran.md

title: "Test Fortran" author: "John Nash" date: "July 3, 2014" output: html_document

Run fortran subroutines

Does it work?

C Fortran test
      subroutine fexp(n, x)
      double precision x
C  output
      integer n, i
C  input value
      do 10 i=1,n
         x=dexp(dcos(dsin(dble(float(i)))))
  10  continue
      return
      end

Now try running it.

res = .Fortran("fexp", n = 100000L, x = 0)
str(res)
## List of 2
##  $ n: int 100000
##  $ x: num 2.72


Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on Aug. 21, 2025, 5:27 p.m.