X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=doc%2Fbin_dec_hex.pod;h=e52f200f841fe662bb4e16c35421f66b8bdd63f5;hp=522820c1cb457f9e348758f8eedc3ef1ab778c42;hb=bf67cc26d0b43871039259add067aa1ed6f0758f;hpb=4b7345f9345915c8061e4b37b26ce8887828c973 diff --git a/doc/bin_dec_hex.pod b/doc/bin_dec_hex.pod index 522820c..e52f200 100644 --- a/doc/bin_dec_hex.pod +++ b/doc/bin_dec_hex.pod @@ -2,8 +2,6 @@ bin_dec_hex - How to use binary, decimal, and hexadecimal notation. -=for html
PDF version.
- =head1 DESCRIPTION Most people use the decimal numbering system. This system uses ten @@ -37,7 +35,7 @@ number 9 can be seen as "00009" and when we should increment 9, we 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 ". @@ -115,7 +113,7 @@ representations, but with eight different symbols. (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 @@ -160,7 +158,8 @@ you're writing in. Some of the prefixes are "0x" for C, "$" for 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: @@ -256,7 +255,7 @@ is therefore "0" and we now have 0xA0??. (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. @@ -276,7 +275,7 @@ and the number of positions will grow rapidly. Using the second method 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 @@ -368,4 +367,4 @@ other people by pointing them to this document when they are asking basic questions. They will not only get their answer, but at the same time learn a whole lot more. -Alex van den Bogaerdt Ealex@ergens.op.het.netE +Alex van den Bogaerdt Ealex@vandenbogaerdt.nlE