home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.lbl.gov / 2014.05.ftp.ee.lbl.gov.tar / ftp.ee.lbl.gov / mtrek.shar.Z / mtrek.shar / size.ftn < prev    next >
Text File  |  1990-04-02  |  391b  |  28 lines

  1.     FUNCTION IWI(I)
  2. C
  3. C    Find the width of the format spec for real and integers
  4. C    and allow for signed numbers.
  5. C
  6.     INTEGER*2 IWI,IWR,I
  7.     REAL X,Y
  8.  
  9. C    Size of an integer
  10.     Y=FLOAT(I)
  11.     GOTO 10013
  12.  
  13. C    Size of a real
  14.     ENTRY IWR(X)
  15.     Y=X
  16. 10013    IF(Y.EQ.0.0)GOTO 10100
  17.  
  18. C    Find the size
  19.     IWI=1+INT(LOG10(ABS(Y)))
  20.     IF(Y.LT.0.0)IWI=IWI+1
  21.     GOTO 10001
  22.  
  23. C    Width of 'zero'
  24. 10100    IWI=1
  25. 10001    CONTINUE
  26.     RETURN
  27.     END
  28.