Skip to main content

The Coordinate Data

The document for NGP-0 (RFC 292) does not say specifically that the format of coordinate data is the same whether the command is in absolute or relative mode. The only thing stated is that they are in two's complement notation with the leftmost bit being the sign bit. It is possible to use two different 2's complement schemes:

           System A                            System B
(Absolute Coordinates) (Relative Coordinates)

-1 -2 -3 -16 0 -1 -2 -15
-2 2 2 ... ...2 -2 2 2 ... 2
+--+--+--+--+---------+--+--+ +--+--+--+--+---------+--+--+
| | | | | | | | | | | | | | | |
+--+--+--+--+---------+--+--+ +--+--+--+--+---------+--+--+
^ ^

.0111 ...............11 = +1/2-e 0.11 ..............11 = 1-e

.00 .................01 = +e 0.100 .............00 = 1/2

.00 .................0 = 0 0.00...............01 = e

.111 ................11 = -e 0.00 ..............00 = 0

.100 ................ = 1/2 1.11 ..............11 = -e

1.10 ..............00 = -1/2

1.00 ..............01 = -1+e = -(1-e)

1.00 ..............00 = -1

-16 -15
Where: e = 2 Where: e = 2

-16 -15
Range: -1/2 to +1/2 - 2 Range: -1 to +1 - 2

I submit that one could interpret the requirement for absolute coordinate data to be in the range -1/2 to +1/2 - e as requiring that two different number systems should be used. Thinking along those lines, System A has the advantage that you never get handed a number out of range, which saves some checking worries. It also has one whole bit more of precision.

I further submit that having two systems to contend with merely clouds the issue and requires extra coding. It makes more sense just to stick with System B above. Among the advantages in its use are:

  1. The single system can handle both absolute and relative coordinates.

  2. If an absolute coordinate exceeds range, simply forcing the sign bit on causes a nice wrap-around.

  3. The representation is the same as the mantissa for floating point numbers on most machines. Notice, however, that mantissas of normalized floating point numbers are not in the range for absolute coordinates. The program will have to shift the mantissa until exponent is 0.

It may be that few of us interpreted the NGP document to mean two number systems were needed. If that is the case, so much the better. In any case, until shaken from the position by the overwhelming force of contrary logic, we will, in all of our implementations, use System B above for both absolute and relative coordinates.