diff --git a/doc/bin_dec_hex.pod b/doc/bin_dec_hex.pod
index 522820c1cb457f9e348758f8eedc3ef1ab778c42..e52f200f841fe662bb4e16c35421f66b8bdd63f5 100644 (file)
--- a/doc/bin_dec_hex.pod
+++ b/doc/bin_dec_hex.pod
bin_dec_hex - How to use binary, decimal, and hexadecimal notation.
bin_dec_hex - How to use binary, decimal, and hexadecimal notation.
-=for html <div align="right"><a href="bin_dec_hex.pdf">PDF</a> version.</div>
-
=head1 DESCRIPTION
Most people use the decimal numbering system. This system uses ten
=head1 DESCRIPTION
Most people use the decimal numbering system. This system uses ten
reset it to zero and increment the digit just before the 9 so the
number becomes "00010". Leading zeros we don't write except if it is
the only digit (number 0). And of course, we write zeros if they occur
reset it to zero and increment the digit just before the 9 so the
number becomes "00010". Leading zeros we don't write except if it is
the only digit (number 0). And of course, we write zeros if they occur
-anywhere inside or at the end of a number:
+anywhere inside or at the end of a number:
"00010" -> " 0010" -> " 010" -> " 10", but not " 1 ".
"00010" -> " 0010" -> " 010" -> " 10", but not " 1 ".
(2) (8) (10) (16)
00000 0 0 0
00001 1 1 1
(2) (8) (10) (16)
00000 0 0 0
00001 1 1 1
- 00010 2 2 2
+ 00010 2 2 2
00011 3 3 3
00100 4 4 4
00101 5 5 5
00011 3 3 3
00100 4 4 4
00101 5 5 5
Pascal, "#" for HTML. It is common to assume that if a number starts
with a zero, it is octal. It does not matter what is used as long as
you know what it is. I will use "0x" for hexadecimal, "%" for binary
Pascal, "#" for HTML. It is common to assume that if a number starts
with a zero, it is octal. It does not matter what is used as long as
you know what it is. I will use "0x" for hexadecimal, "%" for binary
-and "0" for octal. The following numbers are all the same, just their represenatation (base) is different: 021 0x11 17 %00010001
+and "0" for octal. The following numbers are all the same, just their
+representation (base) is different: 021 0x11 17 %00010001
To do arithmetics and conversions you need to understand one more thing.
It is something you already know but perhaps you do not "see" it yet:
To do arithmetics and conversions you need to understand one more thing.
It is something you already know but perhaps you do not "see" it yet:
(which is just plain 16) four times and write down "4" to get 0xA04?.
Subtract 64 from 69 (69 - 4*16) and the last digit is 5 --> 0xA045.
(which is just plain 16) four times and write down "4" to get 0xA04?.
Subtract 64 from 69 (69 - 4*16) and the last digit is 5 --> 0xA045.
-The other method builds ub the number from the right. Let's try 41'029
+The other method builds up the number from the right. Let's try 41'029
again. Divide by 16 and do not use fractions (only whole numbers).
41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
again. Divide by 16 and do not use fractions (only whole numbers).
41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
has the advantage that you can see very easily if you should write down
a zero or a one: if you divide by two the remainder will be zero if it
is an even number and one if it is an odd number:
has the advantage that you can see very easily if you should write down
a zero or a one: if you divide by two the remainder will be zero if it
is an even number and one if it is an odd number:
-
+
41029 / 2 = 20514 remainder 1
20514 / 2 = 10257 remainder 0
10257 / 2 = 5128 remainder 1
41029 / 2 = 20514 remainder 1
20514 / 2 = 10257 remainder 0
10257 / 2 = 5128 remainder 1
basic questions. They will not only get their answer, but at the same
time learn a whole lot more.
basic questions. They will not only get their answer, but at the same
time learn a whole lot more.
-Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
+Alex van den Bogaerdt E<lt>alex@vandenbogaerdt.nlE<gt>