Download TMQ Vol III.i - tim
Transcript
Volume III.i THE MISOSYS QUARTERLY- 20 21 22 23 24 25 26 27 hexadecimal is properly termed sexadecimal Other systems commonly in use are: binary, base 2; octal (which some say should be termed octonary or octonal), base 8; duodecimal, base 12; hexadecimal (which experts say is properly termed sexadecimal), base 16; and sexagesimal, base 60, commonly used for calculations in geodetics (degrees, minutes, seconds,...). If we confme ourselves to a three-place decimal number, say 473 for no particular reason, and apply the general formula, we have a result like this: 473 = 4 * 102 + 7 * iOJ- + 3 * iOO = 4 * 100 + 7 * 10 + 3 * 1 = 473 I have used a "*" symbol to denote multiplication. One of the restrictions on a number system, is that no digit can be of a value which exceeds the base. Thus, we have the class of symbols, [0, 1, 2, 3, 4, 5, 6, 7, 8, 91 representing the ten digits making up the decimal system. Similarly, if we were to consider an octal system, its eight symbols would be the class [0, 1, 2,3, 4, 5, 6, 7). Likewise, the binary system would use a class of two symbols: [0, 1). Hexadecimal, being base 16, has 16 symbols. We arbitrarily use symbols of the alphabet to indicate digits of value greater than 9; thus, [0, 1, 2,3,4,5,6, 7, 8, 9, A, B, C, D, E, F) are the class of symbols for hexadecimal. Very early computers actually were decimal based. I do recollect some early work towards a ternary-based computer using tn-state devices; however, since digital electronics oriented towards a scheme of gates which had two distinct "positions", computers soon switched to the binary system. That's why its important to understand the binary number system and binary mathematics. The binary system is simple since there are only two symbols in its class, (0, 1). If we want to write the number "01011011" in our general formula construct, it would be: SUMMER 1988 1 2 4 8 16 32 64 128 28 29 210 211 212 2 13 2 14 215 Volume III.i 256 512 1024 2048 4096 8192 16384 32768 This shows our number has a value of: 1*64 + 1*16 + 1*8 + 1*2 + 1*1 = 91D Here I have introduced additional notation. The suffix, "D", designates the base of the number. Without that suffix, how would you know I wasn't talking about a hexadecimal number? You wouldn't. Therefore, whenever we are working with different number systems, it is important for us to designate the base of a number by means of a suffix symbol. We commonly use "D" for decimal, "B" for binary, "H" for hexadecimal, and "0" for octal. We generally also assume that a number without a base suffix is expressed as decimal. Sometimes when writing in certain computer languages, its acceptable to use a "Q" as a designator for octal to avoid confusing the letter "oh" and the number "zero" when reading the numeric value. Other problems exist when the language assumes hexadecimal as the default and you want to write a hexadecimal value ending in "B". Is the number "lOB" hexadecimal or binary? To avoid even that confusion, some languages use a "V I' to indicate binary; but that really isn't too common. Up to this point, you should have recognized that the way in which we convert a number from one base to decimal, is to add up the positional values according to our generalized formula expressing the number. But how about converting a decimal number to another base? We can do that easily by repeatedly dividing the decimal number by the desired base saving the remainder as one of the new digits, then repeating the process with the new quotient until the quotient becomes zero. Let's examine this in an example. Convert 247D to binary. I'll use the notation, 0*27 + 1*26 + 0*25 + 1*24 + 1*23 + 0*22 + 1*2 1 +1*20 dividend + divisor = quotient ' remainder When dealing with the binary number system, a power of two table is convenient to either have, or remember. It's quite easy to produce by calculating (if you know how to multiply by 2 without a computer). Here's a short power of two table: Roy's Technical Corner - 28 - Roy's Technical Corner