Binary Numbers .edu
Review end of last class file compression/speed, etc
Binary Numbers
Review binary numbers. 0, 1, 1, 0, etc.
Review - Characters values are stored as ASCII. Hello. = 01001000 01100101 01101100 01101100 01101111 00101110
Unicode 16 bits – 65,536 different bit patterns – Chinese, Japanese, etc can be represented.
In order to allow arithmetic operations, numbers cannot be stored as ASCII. They are stored using excess notation or two’s complement for integers and floating-point notation for decimal-numbers.
Signed Numbers
The leftmost bit is used to indicate the sign of the number:
0 - positive
1- negative
Signed Integer – leftmost signbit is 0 if the number is positive or 0, and 1 if it’s negative.
(Largest 16 bit integer is 32,767 (2 to 15 power – 1). 32-bit is 2,147,483,647 (2 to 31 power – 1).)
Negative numbers are represented in two’s complement form.
Two’s complement notation: The most popular system for presenting integers within today’s computers is two’s complement notation. Each value is represented by a pattern of 32 bits. Such a large system allows a wide range of numbers to be represented.
-231 = -2,147,483,648
231 – 1 = 2,147,483,647
Example of smaller systems:
Using patterns of length three:
(starts 0000 counts up till 0 followed by 111s is reached, and counts backwards in binary until a 1 followed by 0s is reached. )
left most is sign bit.
Bit pattern Value represented
011 3
010 2
001 1
000 0
111 -1
110 -2
101 -3
100 -4
(patterns complement each other – change all 0s to 1s and 1s to 0s).
Using patterns of length four:
Bit pattern Value Represented
0111 7
0110 6
0101 5
0100 4
0011 3
0010 2
0001 1
0000 0
1111 -1
1110 -2
1101 -3
1100 -4
1011 -5
1010 -6
1001 -7
1000 -8
Excess notation: Also for integers:
Bit Pattern Value Represented
111 3
110 2
101 1
100 0
011 -1
010 -2
001 -3
000 -4
excess four notation – exceeds the excess notation interpretation by the value 4.
An excess eight conversion table
Bit Pattern Value Represented
1111 7
1110 6
1101 5
1100 4
1011 3
1010 2
1001 1
1000 0
0111 -1
0110 -2
0101 -3
0100 -4
0011 -5
0010 -6
0001 -7
0000 -8
Ex: 1100 normally represents 12, but in our system it represents 4. 0000 normally represents 0, in our system it represents -8.
Real numbers (e.g., 256.78) use floating point notation to represent the mantissa and the exponent of the number.
0 – nonnegative 1 - negative
256.78 = 2.5678 x 102
01101011
0 = positive
110 = exponent
1011 = mantissa
.1011
110 = 2 (in three bit excess method)
move 2 over to the right. (-2 would be to the left).
10.11
and nonnegative, so it’s 2 ¾.
Another example:
10111100
mantissa .1100
exponent 011= -1
.01100
1 is negative
so -3/8 (011 = 3/8)
Reverse:
1 1/8
1.001
mantissa
_ _ _ _ 1 0 0 1
.1001 we need to move one bit to the right.
101 (positive 1 in excess four notation)
0 because nonnegative
01011001
Round-off Error/Truncation Error
2 5/8 is 10.101. But it’s too big for the mantissa field in one-byte floating-point system. And the rightmost 1 (represents last 1/8) is lost. Instead of 10101 being stored, it’s 1010 in the mantissa field. (01101010) Which represents 2 ½ instead of 2 5/8.
You can reduce the problem by using a longer mantissa field. Most computers today will use at least 32 bits for storing values in floating-point notation instead of the 8 bits here. This also allows for a longer exponent field.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- add binary numbers calculator
- addition of binary numbers calculator
- binary numbers explained
- binary numbers list
- binary numbers tutorial
- binary numbers practice problems
- adding two binary numbers calculator
- converting binary numbers to decimal
- converting binary numbers into decimals
- adding unsigned binary numbers calculator
- dividing binary numbers calculator
- binary numbers python