GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
r1mach.f
Go to the documentation of this file.
1 c Copyright (C) 2008-2018 David Bateman
2 c
3 c This file is part of Octave.
4 c
5 c Octave is free software: you can redistribute it and/or modify it
6 c under the terms of the GNU General Public License as published by
7 c the Free Software Foundation, either version 3 of the License, or
8 c (at your option) any later version.
9 c
10 c Octave is distributed in the hope that it will be useful, but
11 c WITHOUT ANY WARRANTY; without even the implied warranty of
12 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 c GNU General Public License for more details.
14 c
15 c You should have received a copy of the GNU General Public License
16 c along with Octave; see the file COPYING. If not, see
17 c <https://www.gnu.org/licenses/>.
18 c
19  real function r1mach (i)
20  integer i
21  logical init
22  real rmach(5)
23  real slamch
24  external slamch
25  save init, rmach
26  data init /.false./
27  if (.not. init) then
28  rmach(1) = slamch('u')
29  rmach(2) = slamch('o')
30  rmach(3) = slamch('e')
31  rmach(4) = slamch('p')
32  rmach(5) = log10(slamch('b'))
33  init = .true.
34  endif
35  if (i .lt. 1 .or. i .gt. 5) goto 999
36  r1mach = rmach(i)
37  return
38  999 write (*, 1999) i
39  1999 format (' r1mach - i out of bounds', i10)
40  call xstopx (' ')
41  r1mach = 0
42  end
real function r1mach(i)
Definition: r1mach.f:20