C
C      Programmer: Kendrick Taylor
C      Course:     CS 430
C      Date Due:   September 12, 2007
C      Language:   Fortran
C      Compiler used: Force 2.0
C      Source Filename: KTaylorLab2b.f
C      Executable Filename (if any) or None: None
C      Professor: Elizabeth Adams
C
C
C       Description of the program's PURPOSE:
C
C       The program converts a decimal number into a binary number
C       the decimal number is a fractional value
C
C       Description of program's required INPUT:
C
C       A fractional value in base ten in the range 0 - 1
C
C       Description of program's expected OUTPUT:
C
C       Echoed decimal value and binary value
C
C       Descriptions of any MODIFICATIONS made in debugging the program:
C
C       Added a $ to the format statements so the output would stay on
C       the same line.
C
C       General COMMENTS about the PROGRAM
C
C       No error checking is performed
C
C       General COMMENTS explaining syntax or features of the LANGUAGE
C
C       The only thing that I really learned about the language is the
C       use of the ** operator.  Just like in c++ if you do an operation
C       with integers and storing it in a real the language isn't smart
C       enough to do the operation as a float operation as a result
C       2 ** -1 is 0 but 2.0 ** -1 gives the correct answer of .5
C
C

        FACTOR = 0
        FLOAT = 0
        WRITE (6, 20)
        READ (5,30) FLOAT
        WRITE (6, 25) FLOAT
        WRITE (6, 26)
        DO 10 I = -1, -6, -1
          FACTOR = 2.0 ** I
          FTEST = FLOAT - FACTOR
          IF (FTEST .GE. 0) GOTO 100
          WRITE (6, 50)
          GOTO 10
  100     WRITE (6, 51)
          FLOAT = FLOAT - FACTOR
  10    CONTINUE
  50    FORMAT ($,'0')
  51    FORMAT ($,'1')
  20    FORMAT(/$, 'INPUT DECIMAL (0 - 1): ')
  25    FORMAT(/$, 'DECIMAL INPUT: ', F7.6)
  26    FORMAT(//$, 'BINARY REPERSENTATION: .')
  30    FORMAT(F7.7)
        STOP
        END
