RFC 401 (rfc401) - Page 2 of 2


Conversion of NGP-0 Coordinates to Device Specific Coordinates



Alternative Format: Original Text Document



Now factor S into two terms:

                            I
                    S= Q * 2

Where Q is an odd integer and I is an integer.

When:                        I   n     n
                    D = Q * 2 *(2 *f)/2  +S

                             I-n   n
                      = Q * 2   *(2 *f)  +S
             n
The factor (2 *f) is represented in 2's complement form simply by
extending the sign bit of f into the upper portion of the computer
word, If Q = 1 (as it would be with many devices), it can be ignored.
If Q >< 1, we may console ourselves that an integer multiply is faster
on most machines than a floating point multiply.  In fact, on a
PDP-10, this multiply can usually be performed with no access to
memory since Q is usually small.

                          I-n
We are now left with the 2    factor.  This can be accomplished with an
arithmetic shift left by (I-n) or an arithmetic shift right by (n-I)
as is appropriate.  The offset factor, S, may now be added using an
integer add.

The procedure for converting NGP coordinates to integer device
coordinates is then:

               1.   move coordinate to a register and extend sign
               2.   integer multiply by Q (if necessary)
               3.   arithmetic shift left by (I-n)
               4.   integer add S


This procedure would generally be much faster than:

               1.   move coordinate to register and extend sign
               2.   float fractional coordinate
               3.   floating point multiply
               4.   floating point add
               5.   conversion to fixed point

       [ This RFC was put into machine readable form for entry ]
       [ into the online RFC archives by BBN Corp. under the   ]
       [ direction of Alex McKenzie.                      1/97 ]