Mercurial > hg > octave-nkf
annotate examples/code/fortransub.f @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | c8240a60dd01 |
children |
rev | line source |
---|---|
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
1 subroutine fortransub (n, a, s) |
6572 | 2 implicit none |
3 character*(*) s | |
4 real*8 a(*) | |
5 integer*4 i, n, ioerr | |
6 do i = 1, n | |
7 if (a(i) .eq. 0d0) then | |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
8 call xstopx ('fortransub: divide by zero') |
6572 | 9 else |
10 a(i) = 1d0 / a(i) | |
11 endif | |
12 enddo | |
13 write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr) | |
7081 | 14 $ 'There are ', n, |
15 $ ' values in the input vector', char(0) | |
6572 | 16 if (ioerr .ne. 0) then |
18437
4b32677b6229
Rename Fortran example files from 'fort' prefix to 'fortran' prefix.
Rik <rik@octave.org>
parents:
9053
diff
changeset
|
17 call xstopx ('fortransub: error writing string') |
6572 | 18 endif |
19 return | |
20 end | |
21 |