00001
00002 c
00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993,
00004 c by Steve McMillan, Drexel University, Philadelphia, PA.
00005 c
00006 c All rights reserved.
00007 c
00008 c Redistribution and use in source and binary forms are permitted
00009 c provided that the above copyright notice and this paragraph are
00010 c duplicated in all such forms and that any documentation,
00011 c advertising materials, and other materials related to such
00012 c distribution and use acknowledge that the software was developed
00013 c by the author named above.
00014 c
00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 c
00019
00020
00021 subroutine fr labfrm(first,dx,nx,nlab,ndec,npow)
00022 save
00023 c
00024 c Given the (nx) values from (first) in increments of (dx)
00025 c to be written, find a suitable display format.
00026 c
00027 c ndec=-1 : integer format
00028 c ndec.gt.0 : number of places right of dec point
00029 c npow.ne.0 : e format
00030 c nlab = total number of spaces for label
00031 c
00032 c nmax is the maximum number of characters allowed in a number
00033 c without moving to exponential format.
00034 c
00035 data nmax /5/
00036 c
00037 npow=0
00038 c
00039 c Decompose dx into mantissa f and exponent ldx.
00040 c
00041 call compoz(dx,f,ldx)
00042 c
00043 c Find largest label to set scale, and decompose it into f and lbig.
00044 c
00045 final= first+(nx-1)*dx
00046 big=first
00047 if (abs(first).lt.abs(final)) big=final
00048 call compoz(big,f,lbig)
00049 c
00050 c Set nsin = 1 if there are any minus signs involved.
00051 c
00052 nsin=0
00053 if (first.lt.0. .or. final.lt.0.) nsin=1
00054 c
00055 c *** Is integer format OK? (return with npow = 0, ndec = -1 if so) ***
00056 c
00057 if (ldx.lt.0) go to 1
00058 nlab=nsin+1+lbig
00059 c
00060 c Move to exponential format if there are too many digits.
00061 c
00062 if (nlab.gt.nmax) go to 2
00063 c
00064 ndec=-1
00065 return
00066 c
00067 c *** Increment < 1, is F format OK? (ndec > 0, npow = 0) ***
00068 c
00069 1 ndec=abs(ldx)
00070 nlab=nsin+1+ndec
00071 if (lbig.ge.0) nlab=nlab+lbig+1
00072 if (nlab.le.nmax) return
00073 c
00074 c *** Use E format (ndec > 0, npow nonzero) ***
00075 c
00076 2 nlab=nsin+5
00077 npow=lbig
00078 if (abs(npow).ge.10) nex=nex+1
00079 if (npow.lt.0) nlab=nlab+1
00080 ndec=npow-ldx
00081 if (ndec.lt.1) ndec=1
00082 nlab=nlab+ndec
00083 c
00084 end