diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2021-08-03 14:41:53 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2021-08-03 14:41:53 -0400 |
commit | af8fa097905186e0d8ba257e4d70d63fe8901264 (patch) | |
tree | 647de7ddd01c750e9a80849b3cf79efddf32d4b2 /Number.f | |
download | moog-af8fa097905186e0d8ba257e4d70d63fe8901264.tar.gz |
Initial commit
Diffstat (limited to 'Number.f')
-rwxr-xr-x | Number.f | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Number.f b/Number.f new file mode 100755 index 0000000..d6367f5 --- /dev/null +++ b/Number.f @@ -0,0 +1,53 @@ + + 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 + + + + + + |