I have invented a new light
switch. In contrast to a normal light switch (which is either ‘off’ or ‘on’),
it has three positions: Off, Low and High. That means with each
switch I can represent three different pieces of information (a ternary
situation). I am going to build a computer using this as the micro-switch and
applying the same principles as a binary computer.
My basic unit (one
grouping) will be a ‘chomp’ (as opposed to a byte). I am going to include the
entire extended ASCII character set in the data type we call ‘char’ using one
chomp. I don’t have to worry about parity, since my machine will be perfect.
I will only have one type of
integer. It will consist of two
(2) chomps. All my integers will be signed, and I plan to use one of my three
position light switches to represent the sign.
My real numbers will require
three (3) chomps. One (1) switch will be used for the sign (just like my
integers). I am going to assign 5 of my light switches to the characteristic of
the exponent.
(Note: with the exception of the first question (below) each of
these can be answered using a formula (only), although the numeric answers are
not too difficult)
1. How
many of my ternary light switches do I need to group together to include the
entire extended ASCII character set (i.e., how many switches are in a ‘chomp’)?
2. What
will be the range of integers using 2 chomps?
3. What
will be my range of magnitude using my ‘chomp’ machine?
4. What
will be my level of precision using my ‘chomp’ machine?
Given 1 light switch, I can
represent 3 messages. The formula I = Bn (where I is the amount of messages I
can produce given n switches, where each switch has B positions
(in this case, 3)). Therefore:
n |
I |
n |
I |
1 |
31
= 3 |
6 |
36
= 729 |
2 |
32
= 9 |
7 |
37
= 2,187 |
3 |
33
= 27 |
8 |
38
= 6,561 |
4 |
34
= 81 |
9 |
39
= 19,683 |
5 |
35
= 243 |
10 |
310
= 59,049 |
1. Therefore,
in order to represent all of the characters in the extended ASCII character set
I will need 6 light switches (28 = 256; 5 will not be
enough).
2. If
I have 2 chomps (12 light switches). Since 1 light switch will be assigned for
the sign, I have 11 (eleven light switches left). Therefore the range of my
integers will be:
-311 through 311 – 1
= -177,147 to 177,147
3. Given that five light switches are assigned to the
characteristic of the exponent there are a total of 35 (= 243) possible
combinations. However, since the characteristic of the exponent can take on negative
and non-negative values (i.e., one light switch is assigned for the sign), the
range is:
-34 through 34 – 1 =
-81 to 80
4. Given three chomps, I have 3 * 6 = 18 light switches.
Component |
Light Switches |
Total Number: |
18 |
Sign Bit: |
1 |
Characteristic of the Exponent: |
5 |
Remainder (Mantissa) |
12 |
Therefore,
I can have whatever precision is available with 312 combinations,
or:
312 = 531,441 (five (5) decimals
of precision, some to six (6))