Coordinate Format and Derivation
First consider the NGP coordinate format:
+--+-----------+
| | n |
+--+-----------+
s ^ FRACTION
i
g
n
Where the sign occupies the most significant bit of the coordinate followed by bits of numerical information (initial implementation of NGP requires N=15). Negative numbers are represented by 2's complement. Conversion to device coordinates is accomplished by:
D = S * f + S
Where
D =>integer device coordinate
S =>scaling factor (typically M/2)
f =>NGP fractional coordinate
Let us rewrite this as:
n n
D = S*(2 *f)/2 +S
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.