0% found this document useful (0 votes)
80 views22 pages

Representation of Numbers: Dr. Arunachalam V Associate Professor, SENSE

This document discusses various methods for representing numbers in computing systems, including: - Fixed-point and fixed-radix positional number systems that represent integers as a sequence of digits with a fixed radix and number of fractional digits. - Sign-magnitude, biased, 1's complement, 2's complement, and sign-digit representations for signed numbers. Biased representation adds a positive bias to allow signed numbers to be stored unsigned. Complement representations use a complementation constant to unambiguously represent positive and negative values. - Radix, digit set, and redundant representations can vary. Redundant representations allow parallel addition by eliminating carry propagation. Numbers can be converted between different representations through rewriting digits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views22 pages

Representation of Numbers: Dr. Arunachalam V Associate Professor, SENSE

This document discusses various methods for representing numbers in computing systems, including: - Fixed-point and fixed-radix positional number systems that represent integers as a sequence of digits with a fixed radix and number of fractional digits. - Sign-magnitude, biased, 1's complement, 2's complement, and sign-digit representations for signed numbers. Biased representation adds a positive bias to allow signed numbers to be stored unsigned. Complement representations use a complementation constant to unambiguously represent positive and negative values. - Radix, digit set, and redundant representations can vary. Redundant representations allow parallel addition by eliminating carry propagation. Numbers can be converted between different representations through rewriting digits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Representation of numbers

Dr. Arunachalam V
Associate Professor, SENSE
Different assignments of 4-bit code
Fixed-point, Fixed-radix positional number
system
• If the radix (r) is positive integer then the digit set is {0,1,2,3,…, r-1}
• Each unsigned integer is represented by a digit vector of length k+l, with k
digits for the whole part and l digits for fractional part.
• …. . … =∑
• The digit set can be − , − + 1, − + 2, … , − 1, otherwise − , .
• Some examples are:
• Balanced ternary number system: r = 3, digit set [-1,1].
• Negative radix number system: radix = -r, digit set [0, r-1].
– Special case with r = -2, digit set [0,1] is called negabinary number system.
• Non-redundant signed-digit number system: digit set − , − 1 − for
radix r. A negative digit is represented with a – sign .
– r = 10 and α = 4, represent a (3 -1 5)ten representing (300 – 10 + 5 = 295)
Fixed-point, Fixed-radix positional number
system
• Some more examples are:
• Redundant signed-digit number system: digit set − , with + ≥ .
A negative digit is represented with a – sign .
– r = 10 and −7, 7 , 295 can be represented as
– (3 -1 5)ten representing (300 – 10 + 5 = 295)
– (3 0 -5)ten representing (300 + 0 - 5 = 295)
– (1 -7 0 -5)ten representing (1000 - 700 + 0 - 5 = 295)
• Fractional radix number system: r = 0.1 with digit set [0,9].
– . / =∑ 10

• Irrational radix number system: = 2 with digit set [0,1].


• Complex-radix number system: the quater-imaginary number system uses
r = 2j, where = −1 , and the digit set [0,3].
Conversion form one radix to other
• (105.486)ten ≈ (410.22033)five
• (2301.302)four ≈ (?)ten
REPRESENTING SIGNED NUMBERS
Sign-magnitude representation
• = +1= +1 i.e. the interval of 0, − 1 = [0, )
• Maximum of 8-bit non negative number is 255 and signed number is 127
(MSB is sign, 1 for –ve and 0 for +ve)
• Merits : Intuitive appeal, conceptual simplicity, symmetric range and simple
negation (sign change).
• Demerits: addition of numbers with unlike signs must be handled differently
from that of same-sign operands. Hardware implementation is complex.
Biased representation
• Biased representation is based on adding a positive value bias to all
numbers, allowing us to represents the integers from -bias to max-bias
using unsigned values from 0 to max.
Biased representation - usage
• Biased representation does not itself to simple arithmetic algorithms.
• Addition and subtraction become somewhat more complicated because one
must subtract or add the bias from/to the result of a normal add/subtract
operation.
x + y + bias = (x + bias) + (y + bias) - bias
x - y + bias = (x + bias) - (y + bias) + bias
• with k-bit numbers and a bias of 2k-1, adding/subtracting the bias amounts
to complementing the leftmost bit. Thus, the complexity in add/sub is
negligible.
• Multiplication and division become significantly more difficult if these
operations are to be performed directly on biased numbers.
• Therefore, the practical use of biased representation is limited to the
exponent parts of floating-point numbers, which are never multiplied or
divided.
Complement representations
• A suitably large complementation constant M is selected and negative value
-x is represented as the unsigned value M - x.
• To represent integers in the range [-N, +P] unambiguously, M ≥ N + P + 1.
• This prevent overlap between representations of positive and negative
values.
• The choice of M = N + P + 1 yields maximum coding efficiency, since no
code will go to waste.
Complement representations
Addition in a complement number system

Subtraction can be performed by complementing the subtrahend and then


performing additions.
Thus assuming that a selective complementer is available, addition and
subtraction become essentially the same operation, and this is the primary
advantage of this representation.
Complement of fractional part
• Complement representation can be used for fixed-point numbers that have a
fractional part.
• Example:
• M = 12.000 and fixed-point range of [-6.000, +5.999]
• -3.258 has the complement representation 12.000 -3.258 = 8.742.
• For a fixed-point radix-r arithmetic with k whole digits and l fractional
digits:
1. Radix complement =
2. Digit or diminished-radix complement = − .
2’s Complement
• 2's complement => radix is 2 and M is 2k
• 2 − = 2 − − + ulp = +
1’s complement
• 1's complement => radix is 2 and
• 2 − − =
• There is symmetry in the range [ -(2 − ) to (2 − )]
Sign-magnitude representation of digit values

Let us assign -ve weights to an arbitrary subset of k+l positions in a radix-r


number and positive weights to the rest of the positions .
A vector is

with λi in {-1, 1} can be used to specify the signs associated with the various
positions.

λ is +ve , 2’s complement and –ve radix

xi is magnitude of the ith digit and λi is sign


Sign-magnitude representation of digit values

• Sign-magnitude representation of the digit values brings many advantages.


• Any type of coding, including biased or complement representation, can be
used for the digits.
• The range of digit values need not be symmetric.
• Any set − , of radix r or more consecutive integers that include 0 can
be used as digit set for radix r.
• If exactly r digit values are used then it results in irredundant number
system and unique representation for each value in the range.
• If more than r digit values are used, = + + 1 − represents
redundancy index of the number system and some values will have
multiple representations.
• Such redundant representations can eliminate the propagation of carries in
addition and thus allow us to implement truly parallel fast adders.
Example
• Consider a radix-4 number system with digit set [-1,2].

• A k-digit number can represent any integer from − to .


• Given a standard radix-4 integer using digit set [0,3], it can be converted to
the preceding representation by simply rewriting each digit of 3 as -1+4,
where the second term becomes a carry of 1 that propagates leftward.
• Note that the result may require k+1 digits.
• The conversion process stops when there remains no digit with value 3 that
need to be rewritten.
• The reverse conversion is similarly done by rewriting any digit of -1 as 3
with borrow of 1.
Converting a standard radix-4 integer to a radix-4
integer with the nonstandard digit set [-1,2]
Converting a standard radix-4 integer to a radix-4
integer with the nonstandard digit set [-2,2]
Reference
1. Chapter 1, 2 of Behrooz Parhami, “Computer Arithmetic: Algorithms and
Hardware Design”, (2/e) Oxford University Press 2015.
Next class

REDUNDANCY AND REDUNDANT


NUMBER SYSTEM

You might also like