Home ->
ZEPHYR Magazine -> Issue 67
T H E
Z E P H Y R
__ M A G A Z I N E
{__]++++++++++++++++++++++++++[]
Issue #67 8-04-89
A weekly electronic magazine for users of
THE ZEPHYR II BBS
(Mesa, AZ - 602-894-6526)
owned and operated by T. H. Smith
Editor - Gene B. Williams
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. You may share this magazine with your friends under the .
. condition that the magazine remain complete and intact, .
. with no editing, revisions or modifications of any kind, .
. and including this opening section and statement. .
. If you like the magazine, our Sysop and I would appreciate.
. it if you would let your friends know where they can log .
. in to find the magazine (and incidentally one of the .
. finest BBSs in the country!). .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(c) 1989
The "equality issue" is complete, but I thought it more
appropriate to give space to another guest contributor, namely
Michael Setzer. (Look at the list of back issues. The vast
majority are mine - so it's kinda nice to have some "new blood"
on the board.)
Two reminders:
One - Michael Setzer is author of this week's issue, not me.
Credit, questions and comments should all go to him.
Two - I'm always open to guest issues. If you'd care to
contribute, contact me in E-mail. Better yet, start by down
loading issue #27 (ISH.27). That will give you all the
information you need. If you have any other questions, then
contact me.
The Secrets of Converting Hex to Decimal
By Andrew Bartels and Michael Setzer
Before getting into how to convert between the different
numbering systems, it is necessary to understand what a numbering
system is and how it is organized. Take for instance decimal, a
very familiar numbering system. It is called this because its
base is ten. That is, everything written in decimal can be
expressed as a power of 10. For example, when when the number
2304 is written, it can be written like this when more expressive
math is used.
(2*1000)+(3*100)+(0*10)+(4*1)
OR,
3 2 1 0
2*10 + 3*10 0*10 4*10
(Those numbers along the top are exponents)
Thus the entire number (which is the number of bytes in a
granule), is represented in terms of powers of ten, with each
digit (from right to left) progressively being worth one more
power of ten.
Now for a look at hexadecimal. It is called this because it
is a numbering system based on 16. All hex numbers can be
written in terms of powers of 16. In decimal (our first
numbering system), we have the digits 0-9. Each place in the
decimal number (that is like the tens place, hundred place, Etc)
must iterate from 0-9 before the next place iterates. Ex: you
must iterate from 0 to 9 before the ones colum is returned to
zero and the tens column becomes 1.
Hexidecimal has the following possible digits: 0-9, and
A,B,C,D,E,F. Thus there are 16 possible digits for each column.
Note here that the hex digit "A" comes after 9, and that once a
hex column iterates from 0 to f, it is returned to 0, and the
next column over, it is incremented by one. This is the same
procedure that is used used when working with the decimal system.
With Decimal however, there are only 10 positions to work with.
Now for a little comparasion as to see the relationship of hex to
decimal. Observe the following table:
HEX DIGIT DECIMAL NUMBER
--------------------------------------------
0 0
1 1
2 2
. .
. .
. .
9 9
A 10
B 11
C 12
D 13
E 14
F 15
-------------------------------------------
It can now be seen that a Hex digit "A" literally equates to
10 in decimal, "B" corresponds with decimal 11, and so forth.
What would hex "10" translate to decimal? Hex numbers range from
"0" to "F" before the next column is incremented. Therefore,
"10" hex is 16 in decimal. (that is, F+1=10.)
Suppose you have the hex number 1234. It can be written as:
3 2 1 0
1*16 + 2*16 + 3*16 + 4*16
It is the same pattern with decimal, but if the numbers are
tallied, it can be seen that the number is actually 4660 in
decimal.
Now we will attempt to convert a Hex number with the digits
"A" to "F" in it. As was previously discussed, the numbers above
9 inhexidecimal are represented this way: A=10, B=11, C=12,
D=13, E=14, F=15, and so forth. Simply substitute the digit "A"
to "f" with its decimal equivalent when calculating. Try
converting Hex 8C1B to its decimal equivalent.
3 2 1 0
8*16 + 12*16 + 1*16 + 11*16
Notice that the HEX DIGIT "C" has been changed to its
decimal equivalent, 12, andd that the hex "B" is now decimal 11.
This type of conversion is necessary in order to express the hex
numberr in entirely decimal terms. Observe the following:
3 2
8*16 = 32768 AND 12*16 = 3072
1 0
1*16 = 16 AND 11*16 = 11
------ ------
32784 plus this 3083
equals 35867. Therefore, Hex "8C1B" equals decimal 35867!. It
is that simple. Simply convert HEX numbers to decimal by using
the powers of 16...
Until Next Time
Okay, does everyone get that?
This might be a good issue to download, print out and keep
around for reference.
Also on hold is an update of Chris Mitchell's article on how
to get into radio broadcasting. I might go ahead and put that one
up next week, or it might be delayed one more week (or so) for
the long-promised issue.
Other than that, what comes next depends on a number of
factors. Personally, I'd love to see more contributions from the
users, with my own writing going up only to fill the gaps. In
fact, I'd kinda like to have more contributions than there is
room to run.
Dream on, Gene. Dream on.
Zephyr Magazine is ©
Gene Williams. All rights reserved.