-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathNumber.f
executable file
·53 lines (33 loc) · 1.12 KB
/
Number.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
subroutine number (nchar,line,xnum)
c******************************************************************************
c this routine decodes a character string into a double precision
c floating point number
c******************************************************************************
include 'Pstuff.com'
real*8 xnum
character form*10
c*****if a carriage return has been hit, return with -9999.
if (nchar .le. 0) then
xnum = -9999.
return
endif
c*****set the conversion format
if (nchar .lt. 10) then
write(form,1001) nchar
else
write(form,1002) nchar
endif
c*****now do the conversiton to a number
read (unit=chinfo,fmt=form,iostat=ierr,err=100) xnum
return
c*****here an error has been detected
100 write (errmess,1004) ierr,chinfo(1:nchar)
nchars = 65
istat = ivwrite (line,3,errmess,nchars)
xnum = -9999.
return
c*****format statements
1001 format('(f',i1,'.0) ')
1002 format('(f',i2,'.0) ')
1004 format ('ERROR IN NUMBER INPUT: ERROR=',i4,5x,'NUMBER=',a20)
end