Decimal |
Binary |
2’s Compliment |
Sign Magnitude |
Excess-4 |
Fixed Point |
0
|
000
|
0
|
0
|
-4
|
0 (00.1)
|
1
|
001
|
1
|
1
|
-3
|
.5 (01.0)
|
2
|
010
|
2
|
2
|
-2
|
1.0 (01.1)
|
3
|
011
|
3
|
3
|
-1
|
1.5
|
4
|
100
|
-4
|
-0
|
0
|
2.0
|
5
|
101
|
-3
|
-1
|
1
|
2.5
|
6
|
110
|
-2
|
-2
|
2
|
3.0
|
7
|
111
|
-1
|
-3
|
3
|
3.5
|
- Leading digit indicates sign
o 0 = positive number
o 1 = negative number
- Rest of bits are used to indicate the magnitude of the number.
- Good for creating a "human readable" representation of positive and negative integers.
- Hard to use for mathematics.
- Moves everything a set number of positions (in above example 4).
- Generally you would assign to the lowest bitstring (000 in our example) the smallest value, assign the highest bitstring (111) the largest value. This "balances" the 0 position close to the middle. However, you can have more positive numbers then negative, exclude zero, etc.
- Addition in excess: Add together, subtract excess off.
- Used for representation of really small or really large numbers
- Gap - space between number systems (in our example above, the gap is .5)
- Precision - number of bits you use
- Represented by letters
o ex. sdd.f – the s means signed, d indicates numbers before binary point (digit), f indicates numbers after binary point (float)
- dd.f example: 001 -> 00.1 -> 1 x 2^-1 = 1/2 = .5
- d.ff = 001 -> 00.1 -> 0x2^0 + 0x2^-1 + 1x2^-2 = .25
- Signed (+/-) - Gap of .25 - 4 digits - sd.ff
o 0111 = 1.75
o 1000 = 0
o 1111 = -1.25
- Regular Expression: d.d*x10^d+
o 15x10^8
wrong
o 1.5x10^9 right
- Example of a negative number: -4.2x10^6
- Example of a small number: 6.2x10^-15
- 1.5e9 is how a computer might display scientific notation.
o Consists of three essential parts:
§ Sign
§ Mantissa
§ Exponent