home *** CD-ROM | disk | FTP | other *** search
- subroutine number (xpage, ypage, height, fpn, angle, ndec)
- real xpage, ypage, height, fpn, angle
- integer ndec
- C
- C Convert floating point number into numbers on graph
- C
- C Limit: f19.9 maximum number printable
- C If this limit is raised, string lengths and formats must be changed
- C
- C Basic method: build proper string, hand to symbol
- C
- C Rex Sanders, USGS, 3/87
- C
- character*19 floats
- character* 7 formts
- integer maxnpl, maxnpr
- parameter (maxnpl = 9, maxnpr = 9)
-
- real afpn
- integer npl, npr, nchar, ntrunc, inum
-
- afpn = abs (fpn)
- C
- C First cut on # places left of decimal point
- C
- if (fpn .eq. 0) then
- npl = 1
- else if (fpn .gt. 0) then
- npl = max (int (log10 (fpn)), 0) + 1
- else if (fpn .lt. 0) then
- npl = max (int (log10 (afpn)), 0) + 2
- endif
- C
- C Guaranteed a decimal point
- C
- if (ndec .ge. 0) then
- npl = min (npl, maxnpl)
- npr = min (ndec, maxnpr)
- nchar = npl + npr + 1
- write(formts, 101) nchar, npr
- 101 format('(f', i2, '.', i1, ')')
- write(floats, formts) fpn
- C
- C No decimal point, write as integer
- C
- else
- ntrunc = abs (ndec) - 1
- npl = max (min (npl - ntrunc, maxnpl), 1)
- write(formts, 102) npl
- 102 format('(i', i1, ')')
-
- inum = nint(fpn/(10**ntrunc))
- write(floats, formts) inum
- nchar = npl
- endif
-
- call symbol (xpage, ypage, height, floats, angle, nchar)
-
- return
- end
-