annotate examples/fortsub.f @ 17289:4d7f95eb8bfe

doc: Miscellaneous small tweaks to documentation for consistency. * doc/interpreter/external.txi: Don't group EXAMPLEFILEs which are longer than 20 lines. * doc/interpreter/oop.txi: Don't group EXAMPLEFILEs which are longer than 20 lines. * doc/interpreter/octave.texi: Eliminate trailing whitespace. * doc/interpreter/tips.txi: Eliminate trailing whitespace. * examples/mysparse.c: Eliminate trailing whitespace. * scripts/miscellaneous/compare_versions.m: use @qcode macro. * scripts/plot/gnuplot_binary.in: use @qcode macro. * scripts/statistics/tests/kruskal_wallis_test.m: use @cite macro.
author Rik <rik@octave.org>
date Tue, 20 Aug 2013 09:25:35 -0700
parents 4295d634797d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
1 subroutine fortsub (n, a, s)
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
2 implicit none
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
3 character*(*) s
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
4 real*8 a(*)
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
5 integer*4 i, n, ioerr
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
6 do i = 1, n
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
7 if (a(i) .eq. 0d0) then
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
8 call xstopx ('fortsub: divide by zero')
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
9 else
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
10 a(i) = 1d0 / a(i)
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
11 endif
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
12 enddo
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
13 write (unit = s, fmt = '(a,i3,a,a)', iostat = ioerr)
7081
503001863427 [project @ 2007-10-31 01:08:14 by jwe]
jwe
parents: 7019
diff changeset
14 $ 'There are ', n,
503001863427 [project @ 2007-10-31 01:08:14 by jwe]
jwe
parents: 7019
diff changeset
15 $ ' values in the input vector', char(0)
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
16 if (ioerr .ne. 0) then
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
17 call xstopx ('fortsub: error writing string')
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
18 endif
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
19 return
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
20 end
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
21