



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lecture notes on number systems, covering the concept of numbers versus numerals, positional number systems, conversion between different bases, and systems of special interest such as binary, octal, and hexadecimal. It also discusses integer representation in real computers, arithmetic on positional systems, and representation of other scalars like alphanumeric characters and real numbers.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




1. Question: Which is the bigger number?
5 3 2 (ans 5)
Alternative question: Which is “five”?
five V cinq 101 (ans none)
The point: These are all names of the abstract notion of ‘fiveness’. We can invent LOTS of other systems to name numbers. NUMBER != NUMERAL
2. Positional (Polynomial) Number Systems Example: decimal: 346 = 3100 + 410 + 6*
general: “ radix R” or “base R”:
Integers
and
Reals
Do some examples: binary , ternary, octal , hexadecimal.
3. Conversion Radix R - to - Decimal: Compute the expansion
d (^) n d (^) n – 1 ... d 0 d (^) i × R i i = 0
n
dn d (^) n – 1 ... d 0 • d (^) – 1 d (^) – 2 ... d (^) – m d (^) i × R i i =– m
n
Radix Point
n d (^) n R n ... d 0 R 0 = + +
Decimal - to - Radix R
Algorithm:
Radix R 1 to Radix R (^2)
R 1 to decimal to R (^2)
4. Systems of Special Interest Binary base 2 Easy for computers Octal base 8 Easier for people Hexadecimal base 16 Easier for people
Show conversion between all of these
Emphasize hex numbering 0 ... 9ABCDEF
5. Integer Representation in Real Computers Issues: Fixed Size, Negative Number Representation A. Fixed Size “The XXX is a 16-bit (vs 32-bit) computer ...” If “word” size is n bits
there are 2 n^ possible bit patterns so only 2n^ possible distinct numbers
Implications:
B. Negative Number Representation i. sign magnitude (the obvious one)
n R
--- d (^) n R n – 1 ... d 1 R 0 = + + ,with remainder d 0
0 n-
Negation: Complement means flip the bit, so flip every bit and add one Example (R=2, n=8): 9510 0010111 flip 1101000 add 1 1101001 (-95) Note that “re-negating” gets us back to the original.
Notes:
iii. excess B Represent k (whether + or -) as k + B
Note: allows asymetric range.
6. Arithmetic on Positional Systems A. General Arithmetic We all know how to do arithmetic in radix 10 using carries
Same in other radices, just use a different table. Example: Our hero, binary.
B. Sign magnitude
0 B-1 B R^ n
-B -1^0 R n-B-
<sum,carry>
0,0 1,0 2, 1,0 2,0 3,0 0,
9,
1,0 0, 0,1 1,
0,0 1, 1,0 0,
Carry in 1
C. 2’s complement
Examples : Assume 4-bit computer, first bit is sign bit.
D. Overflow i. Demonstration
We call this OVERFLOW. The number “13” is not representable in a 4-bit, 2’s complement computer.
Question: Does the problem go away if we have more bits? Answer: Nope, not in general, though we could safely add 6+7 with more bits.
ii. Detection.
OY!! That’s Negative??!!
Question : What’s the value of “0110010110111001”? Answer: You CANNOT tell. There is no notion of TYPE at the bit level in computers. These notions are realized at higher levels.
Table 1: IEEE Floating Point Standard.
Single Double
Mantissa bits(incl hidden) 24 53
sign bits 1 1
exponent bits 8 11
Bias/Excess 127 1023
Max Exponent 127 1023
Min Exponent -126 -