Code

Imported upstream SVN snapshot 1.4~rc2+20090928.
[pkg-rrdtool.git] / doc / bin_dec_hex.txt
index 55607153de9f46f9bbb1bdfb981131511845b4e7..ca4cc46874bbb5d7364601fca20eb8673aefc88c 100644 (file)
@@ -6,8 +6,8 @@ N\bNA\bAM\bME\bE
        bin_dec_hex - How to use binary, decimal, and hexadecimal notation.
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-       Most people use the decimal numbering system. This system uses ten sym-
-       bols to represent numbers. When those ten symbols are used up, they
+       Most people use the decimal numbering system. This system uses ten
+       symbols to represent numbers. When those ten symbols are used up, they
        start all over again and increment the position to the left. The digit
        0 is only shown if it is the only symbol in the sequence, or if it is
        not the first one.
@@ -31,9 +31,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
        and so on.
 
-       Each time the digit nine is incremented, it is reset to 0 and the posi-
-       tion before (to the left) is incremented (from 0 to 1). Then number 9
-       can be seen as "00009" and when we should increment 9, we reset it to
+       Each time the digit nine is incremented, it is reset to 0 and the
+       position before (to the left) is incremented (from 0 to 1). Then number
+       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
@@ -66,39 +66,39 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        If you count the number of rows, you'll see that these are again 14
        different numbers. The numbers are the same and mean the same as in the
        first list, we just used a different representation. This means that
-       you have to know the representation used, or as it is called the num-
-       bering system or base.  Normally, if we do not explicitly specify the
-       numbering system used, we implicitly use the decimal system. If we want
-       to use any other numbering system, we'll have to make that clear. There
-       are a few widely adopted methods to do so. One common form is to write
-       1010(2) which means that you wrote down a number in its binary repre-
-       sentation. It is the number ten. If you would write 1010 without speci-
-       fying the base, the number is interpreted as one thousand and ten using
-       base 10.
-
-       In books, another form is common. It uses subscripts (little charac-
-       ters, more or less in between two rows). You can leave out the paren-
-       theses in that case and write down the number in normal characters fol-
-       lowed by a little two just behind it.
+       you have to know the representation used, or as it is called the
+       numbering system or base.  Normally, if we do not explicitly specify
+       the numbering system used, we implicitly use the decimal system. If we
+       want to use any other numbering system, we'll have to make that clear.
+       There are a few widely adopted methods to do so. One common form is to
+       write 1010(2) which means that you wrote down a number in its binary
+       representation. It is the number ten. If you would write 1010 without
+       specifying the base, the number is interpreted as one thousand and ten
+       using base 10.
+
+       In books, another form is common. It uses subscripts (little
+       characters, more or less in between two rows). You can leave out the
+       parentheses in that case and write down the number in normal characters
+       followed by a little two just behind it.
 
        As the numbering system used is also called the base, we talk of the
        number 1100 base 2, the number 12 base 10.
 
-       Within the binary system, it is common to write leading zeros. The num-
-       bers are written down in series of four, eight or sixteen depending on
-       the context.
+       Within the binary system, it is common to write leading zeros. The
+       numbers are written down in series of four, eight or sixteen depending
+       on the context.
 
-       We can use the binary form when talking to computers (...program-
-       ming...), but the numbers will have large representations. The number
-       65'535 (often in the decimal system a ' is used to separate blocks of
-       three digits for readability) would be written down as
+       We can use the binary form when talking to computers
+       (...programming...), but the numbers will have large representations.
+       The number 65'535 (often in the decimal system a ' is used to separate
+       blocks of three digits for readability) would be written down as
        1111111111111111(2) which is 16 times the digit 1.  This is difficult
        and prone to errors. Therefore, we usually would use another base,
        called hexadecimal. It uses 16 different symbols. First the symbols
-       from the decimal system are used, thereafter we continue with alpha-
-       betic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E
-       and F. This system is chosen because the hexadecimal form can be con-
-       verted into the binary system very easily (and back).
+       from the decimal system are used, thereafter we continue with
+       alphabetic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D,
+       E and F. This system is chosen because the hexadecimal form can be
+       converted into the binary system very easily (and back).
 
        There is yet another system in use, called the octal system. This was
        more common in the old days, but is not used very often anymore. As you
@@ -137,10 +137,11 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
        Most computers used nowadays are using bytes of eight bits. This means
        that they store eight bits at a time. You can see why the octal system
-       is not the most practical for that: You'd need three digits to repre-
-       sent the eight bits and this means that you'd have to use one complete
-       digit to represent only two bits (2+3+3=8). This is a waste. For hex-
-       adecimal digits, you need only two digits which are used completely:
+       is not the most practical for that: You'd need three digits to
+       represent the eight bits and this means that you'd have to use one
+       complete digit to represent only two bits (2+3+3=8). This is a waste.
+       For hexadecimal digits, you need only two digits which are used
+       completely:
 
         (2)      (8)  (10) (16)
         11111111 377  255   FF
@@ -159,8 +160,8 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        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 representa-
-       tion (base) is different: 021 0x11 17 %00010001
+       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"
@@ -269,9 +270,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        Which method to use is up to you. Use whatever works for you.  I use
        them both without being able to tell what method I use in each case, it
        just depends on the number, I think. Fact is, some numbers will occur
-       frequently while programming. If the number is close to one I am famil-
-       iar with, then I will use the first method (like 32'770 which is into
-       32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).
+       frequently while programming. If the number is close to one I am
+       familiar with, then I will use the first method (like 32'770 which is
+       into 32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).
 
        For binary the same approach can be used. The base is 2 and not 16, and
        the number of positions will grow rapidly. Using the second method has
@@ -348,18 +349,19 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
        For low values, try to do the calculations yourself, then check them
        with a calculator. The more you do the calculations yourself, the more
-       you'll find that you didn't make mistakes. In the end, you'll do cal-
-       culi in other bases as easily as you do them in decimal.
+       you'll find that you didn't make mistakes. In the end, you'll do
+       calculi in other bases as easily as you do them in decimal.
 
        When the numbers get bigger, you'll have to realize that a computer is
-       not called a computer just to have a nice name. There are many differ-
-       ent calculators available, use them. For Unix you could use "bc" which
-       is short for Binary Calculator. It calculates not only in decimal, but
-       in all bases you'll ever want to use (among them Binary).
+       not called a computer just to have a nice name. There are many
+       different calculators available, use them. For Unix you could use "bc"
+       which is short for Binary Calculator. It calculates not only in
+       decimal, but in all bases you'll ever want to use (among them Binary).
 
-       For people on Windows: Start the calculator (start->programs->acces-
-       sories->calculator) and if necessary click view->scientific. You now
-       have a scientific calculator and can compute in binary or hexadecimal.
+       For people on Windows: Start the calculator
+       (start->programs->accessories->calculator) and if necessary click
+       view->scientific. You now have a scientific calculator and can compute
+       in binary or hexadecimal.
 
 A\bAU\bUT\bTH\bHO\bOR\bR
        I hope you enjoyed the examples and their descriptions. If you do, help
@@ -371,4 +373,4 @@ A\bAU\bUT\bTH\bHO\bOR\bR
 
 
 
-1.3.99909060808                   2009-02-21                    BIN_DEC_HEX(1)
+1.3.999                           2009-07-12                    BIN_DEC_HEX(1)