We will now figure the mapping between any 3 digit number and its signed value:
3 digit number Signed value -------------- -------------- 000 <---> ... 001 <---> ... 999 <---> ... |
The mapping will have desirable computational properties !!
This mapping allows use to perform + and − operations independently (i.e., the values of the operands has no effect on the meaning of the operation !)
It's important that you understand that:
|
Problem description:
how to map
all the
3 digit code to the
signed values:
3 digit 10s compl code 000 001 002 003 ... 998 999 (odometer code) / / / \ \ +---+...+---+---+---+---+---+---+---+---+...+---+ •••• ••• •• • ( ) • •• ••• •••• -4 -3 -2 -1 0 1 2 3 4 Signed value |
The mapping will help us perform arithmetic operation better !!!
Comment:
we are mapping to
values that are
intrinsic (e.g.: •, ••, ... and
•, ••, ...).
For
convenience (brevity),
I also
wrote down the signed decimal number.
Question:
what 3 digit code
should we use to map the
value ZERO to ?
3 digit
10s compl code
(odometer code)
???
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Answer:
000
because this odometer meter reading
is when the car is new
3 digit
10s compl code
(odometer code)
000
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Question:
what 3 digit code
should we use to map the
value ONE to ?
3 digit
10s compl code
(odometer code)
000 ???
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Answer:
001
because 000 + 1 = 001
and also:
001 − 1 = 000
3 digit
10s compl code
(odometer code)
000 001
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
So if 001 represents the value • (ONE), we can perform addition and subtraction "naturally" (i.e., the value of the operands do not change the meaning of the +/− operation !!)
Question:
what 3 digit code
should we use to map the
value TWO to ?
3 digit
10s compl code
(odometer code)
000 001 ???
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Answer:
002
because 001 + 1 = 002
and also:
002 − 1 = 001
3 digit
10s compl code
(odometer code)
000 001 002
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
So if 002 represents the value •• (TWO), we can perform addition and subtraction "naturally"
Question:
what 3 digit code
should we use to map the
value
NEGATIVE ONE to ?
3 digit
10s compl code
(odometer code)
??? 000 001 002
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Answer:
999
because 999 + 1 = 000
and also:
000 − 1 = 999
Read as the equation as: NEG ONE + 1 = ZERO and
ZERO − 1 = NEG ONE
3 digit
10s compl code
(odometer code)
999 000 001 002
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
So if 999 represents the value • (NEGATIVE ONE), we can perform addition and subtraction "naturally" (i.e., the value of the operands do not change the meaning of the +/− operation !!)
Question:
what 3 digit code
should we use to map the
value
NEGATIVE TWO to ?
3 digit
10s compl code
(odometer code)
??? 999 000 001 002
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
Answer:
998
because 998 + 1 = 999
and also:
999 − 1 = 998
Read as the equation as: NEG TWO + 1 = NEG ONE and
NEG ONE − 1 = NEG TWO
3 digit
10s compl code
(odometer code)
998 999 000 001 002
+---+...+---+---+---+---+---+---+---+---+...+---+
•••• ••• •• • ( ) • •• ••• ••••
-4 -3 -2 -1 0 1 2 3 4
Signed value
|
So if 998 represents the value •• (NEGATIVE TWO), we can perform addition and subtraction "naturally" (i.e., the value of the operands do not change the meaning of the +/− operation !!)
And so on:
3 digit 10s compl code (odometer code) 996 997 998 999 000 001 002 003 004 +---+...+---+---+---+---+---+---+---+---+...+---+ •••• ••• •• • ( ) • •• ••• •••• -4 -3 -2 -1 0 1 2 3 4 Signed value |
Question: where should we stop ???
Equal proportion representation: we want represent a (approximately) same number of positive values and negative values
The
3 digit 10s complement code
mapping
onto the
set of
signed value [-500..499]
is as follows:
3 digit 10s compl code (odometer code) 500 996 997 998 999 000 001 002 003 004 499 +---+...+---+---+---+---+---+---+---+---+...+---+ •••• ••• •• • ( ) • •• ••• •••• -500 -4 -3 -2 -1 0 1 2 3 4 499 Signed value |
|
Let's see what the 10s complement code can do for us - next