DIVISION                        

    Purpose: To divide giving result in the form 

                   a
                  --- = AM     +   AL
                   b      +/-        f

             AM in integer signed form
             AL in fractional form
            
    Cue: Magnetic Storage: single half track
         electronic storage: tube 1
         control number: $E
         self-resetting

    Link: closed

    Input details: conventional procedure
  
    Effects:
       
        +---------+---------------------+-----------------+ 
        |  Lines  | Initial             | Final           |
        | altered | contents            | contents        |
        +---------+---------------------+-----------------+ 
        | D       | D  = 1 > a >= -0.5  | irrelevant      |
        |         |  f                  |                 |
        |         |     depending on    |                 |
        |         |     whether it is   |                 |
        |         |     set by /C or /K |                 |
        |         |                     |                 |
        | AL      | AL       = b        | \             a |
        |         |   +/-f              | ! AM  + AL  = - |
        |         |                     | !   +     f   b |
        | AM      | Irrelevant          | /   -           |
        |         |                     |                 |
        +---------+---------------------+-----------------+ 

    Time: 90 ms

    Notes: 1. Number of significant figures in result is about 2 or 3 less
              than the number of significant figures in a or b, whichever is
              the lesser.

           2. As an illustration, to find the reciprocal of (say) [/I] +/-f
              (signed fractional form) the necessary instructions in the main
              routine are:

                  n-3 | D S / C | set a = 1 (approx.)
                  n-2 | / I T / | set b
                  n-1 | s,  / J | \ loads in AM the routine cue stored at addr s
                  n   | n,  Q O | ! calls in DIVISION
                  n+1 | F S / P | /

    Ferranti Mark I Programming Manual, third edition 
    Bodleian Special Collection 
    MS. Eng. misc. b. 260-C.41.pdf
    p46
    
    [Routine DIVISION      ] 

    [Col     @ ]                        [        A ]              
                                                                          
    | / | VATA | plants divisor b       | / | MA/F |                                         
    | E | :S/N | AM=a/4=a0              | E | LS/P | closure       
    | @ | VATJ | \                      | @ | QV$$ | = -41                                  
    | A | MA/A | ! makes divisor +ve    | A | IE// | = 38                                   
    | : | VA/J | ! changing sign of     | : |      |                                        
    | S | VATJ | ! dividend if          | S |      |                                        
    | I | VA/A | / necessary            | I |      |                                        
    | U | VA/@ | \                      | U |      |               
    | # | GA/A | !                      | # |      |                                        
    | D | AAQO | !                      | D |      |                                        
    | R | GAQG | !                      | R |      |                                        
    | J | GAQG | ! multiplies b0 by 2^n | J |      |               
    | N | E:/C | ! such that 1 > 2^b*b0 | N |      |               
    | F | @AQG | ! >= 0.5: records addr | F |      |               
    | C | /:UC | ! of 2^n in B7         | C |      |               
    | K | //T: | !                      | K |      |               
    | T | VA/N | !                      | T |      |               
    | Z | VATA | / [VA]=b0[VA]=b0-1=c0  | Z |      |               
    | L | IST/ |   sets round off       | L |      |               
    | W | VA/K | \ repetitive cycle:    | W |      |               
    | H | MA/J | ! a(n+1)=an-an*cn,     | H |      |               
    | Y | MA/D | ! an -> a/4*2^n*b      | Y |      |               
    | P | MA/A | ! c(n+1)=-cn^2, cn->0  | P |      |                                    
    | Q | VA/D | !                      | Q |      |                                    
    | O | A:/M | ! tests for end        | O |      |                                    
    | B | VA/A | ! when cn^2 < 2^40     | B |      |                                    
    | G | "@/P |_/_____                 | G | USED |          \                         
    | " | L@T: |                        | " | USED |          !                  
    | M | /:UC | \ multiplies result by | M | USED | an       ! working
    | X | MA/F | ! 4*2^n to correct for | X | USED |          ! lines
    | V | MA/F | ! previous scaling     | V | USED | bn, bn-1 !    
    | $ | MA/F | !                      | $ | USED |          /    
                                                                          
        
    [End]
