n301/cs04othernumbers
n301.tplt
Last time
We converted from Decimal to Binary, Binary to Decimal
Other numbering systems
Octal – base 8
Hexadecimal – base 16
Octal
How this relates to computers
- byte is a eight-bit binary number
It takes exactly one byte to specify one character is ASCII (American Standard Code for Information Interchange)
ASCII
What is it?
- each character on a computer is assigned a unique binary code number
The computers use a code called ASCII, in which an eight-bit binary number represents each character – thus one byte (2^8 or 256)
Converting to Base 8
Break it into binary
| base 10 | 32 | 16 | 8 | | 4 | 2 | 1 |
| base 2 | 1 | 0 | 1 | | 1 | 1 | 0 |
| base 8 | | 5 | | | | 6 | |
Hexadecimal – base 16
Uses for hexadecimal – colors
Values – 0 - F
Other Numbers
Twos Compliment
Floating Point
Twos Compliment
In decimal notation, a negative number is preceded by a ‘-‘ (minus sign)
This is not possible in binary, so we declare one bit to be a sign bit and the rest of the number to be the quantity
The complement of a number in a given base can be defined as the difference between each digit of the number and the maximum digit value for the base.
Example: Base 10
number is 26 compliment is 73 which is 9-2 = 7 and 9-6 = 3 or the compliment of 73
Floating Point /1
If x is any real number, its normal form representation is,
x = f * 10E
Example:
125.32 = 0.12532 * 103
-125.32 = -0.12532 * 103
0.65 = 0.65 * 100
Floating Point/2
The number f of the representation is called the mantissa and the E is the exponent
Example
sign of mantissa | | sign of exponent | |
| d1 | d2 | d3 | d4 | d5 | d6 | d7 | d8 |
| digits of mantissa | | digits of exponent |