Upload
ann-henderson
View
226
Download
0
Embed Size (px)
DESCRIPTION
© Ienne, Oklobdzjia 2004CompArith — Number Representation3 What Is a Number System? A number is represented as an ordered n-tuple of symbols (digit vector) Each symbol is a digit Digits usually represent integers from a given set—e.g.,
Citation preview
Computer Arithmetic —
Number Representation
[email protected] – I&C – LAP
[email protected] EPFL – CSDA and UC Davis – ACSEL
© Ienne, Oklobdzjia 2004CompArith — Number Representation2
Why Representation?Need to map numbers to binary bits
Need a representation anyway…
Representation is consequential Complexity of arithmetic operations
depends heavily on the representation
Number representation is the heart of computer arithmetic…
© Ienne, Oklobdzjia 2004CompArith — Number Representation3
What Is a Number System? A number is represented as an ordered n-tuple of
symbols (digit vector)
Each symbol is a digit
Digits usually represent integers from a given set—e.g.,
01221 ... aaaaa nn
01221 ,,,, aaaaa nn
1,0,19,...,1,01,0 iii aaa or or
© Ienne, Oklobdzjia 2004CompArith — Number Representation4
Rule of Interpretation Mapping from set of digit vectors to numbers
(e.g., integers, reals)
12 “twelve”
digit vectors N, Z, R,…
© Ienne, Oklobdzjia 2004CompArith — Number Representation5
Positional Weighted Systems The rule of interpretation is a scalar product
where
is the weight vector
01221 ,,,..., wwwwwW nn
1
001221 ...
n
iiinn waaaaaaA
© Ienne, Oklobdzjia 2004CompArith — Number Representation6
Radix Systems Weights are not arbitrary but related to a radix
vector
in the following way
01221 ,,,..., rrrrrR nn
1
0110 1
i
jjiii rrwww
© Ienne, Oklobdzjia 2004CompArith — Number Representation7
Mixed-Radix Systems Fixed-radix if all elements of R are identical
A few mixed-radix systems are very common—e.g., time
1,60,3600,86400
60,60,24
W
R
in
ii
ii raArw
1
0
© Ienne, Oklobdzjia 2004CompArith — Number Representation8
Common Decimal NotationIt is weighted
It is positional
It is fixed-radixi
i rw
1
001221 ...
n
iiinn waaaaaaA
iwi ononly depends
© Ienne, Oklobdzjia 2004CompArith — Number Representation9
Common Decimal NotationIt is nonredundant because canonical
10n possible digit vectors to represent 10n values
Weighted, positional, fixed-radix, nonredundant
also called conventional systems
1...,,1,0 rai
© Ienne, Oklobdzjia 2004CompArith — Number Representation10
Digit SetCanonical set
A canonical system is nonredundant
Any other choice is noncanonical
2,1,0,1ia
2/,12/,...,0...,),12/( rrrai
1,0,1ia
1...,,1,0 rai
© Ienne, Oklobdzjia 2004CompArith — Number Representation11
Very Large Choice of Weighted Positional Number Systems
Sour
ce: P
arha
mi,
© O
xfor
d 20
00
© Ienne, Oklobdzjia 2004CompArith — Number Representation12
Sign-and-Magnitude Representation
Some advantages and disadvantagesFamiliar for usersSimple naïve multiplicationAdders are not the most efficientRedundant zero (+0 and –0) may cause
some problems (e.g. testing for a variable =0)
© Ienne, Oklobdzjia 2004CompArith — Number Representation13
References M. D. Ercegovac and T. Lang, Digital Arithmetic,
Morgan Kaufmann, 2004 I. Koren, Computer Arithmetic Algorithms, Peters,
2002 A. R. Omondi, Computer Arithmetic Systems—
Algorithms, Architecture and Implementation, Prentice Hall, 1991
B. Parhami, Computer Arithmetic—Algorithms and Hardware Designs, Oxford, 2000