02.10.2019 Views

UploadFile_6417

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Representation of Numbers 259<br />

negative integers between −2 B−1 and 2 B−1 − 1 are given by<br />

x (e)<br />

∆<br />

=2 B−1 + x (6.35)<br />

For example, using 3 bits, we can represent the numbers from −4 to<br />

3as<br />

-4 -3 -2 -1 0 1 2 3<br />

-+----+----+----+----+----+----+----+-<br />

000 001 010 011 100 101 110 111<br />

Notice that this format is very similar to the two’s-complement format,<br />

but the sign bit is complemented. The arithmetic for this format is similar<br />

to that of the two’s-complement format. It is used in the exponent of<br />

floating-point number representation.<br />

6.6.2 GENERAL FIXED-POINT ARITHMETIC<br />

Using the discussion of integer arithmetic from the last section as a guide,<br />

we can extend the fixed-point representation to arbitrary real (integer<br />

and fractional) numbers. We assume that a given infinite-precision real<br />

number, x, isapproximated by a binary number, ˆx, with the following bit<br />

arrangement:<br />

ˆx = ±<br />

↑<br />

xx ···x<br />

} {{ }<br />

“L”<br />

Sign bit<br />

Integer bits<br />

<br />

xx ···x<br />

} {{ }<br />

“B”<br />

Fraction bits<br />

(6.36)<br />

where the sign bit ± is 0 for positive numbers and 1 for negative numbers,<br />

x represents either a 0 or a 1, and represents the binary point. This<br />

representation is in fact the sign-magnitude format for real numbers, as<br />

we will see. The total word length of the number ˆx is then equal to L+B+1<br />

bits.<br />

□ EXAMPLE 6.14 Let L =4and B =5,which means ˆx is a 10-bit number. Represent 1101001110<br />

in decimal.<br />

Solution<br />

ˆx = −(1 × 2 3 +0× 2 2 +1× 2 1 +0× 2 0 +0× 2 −1 +1× 2 −2 +1× 2 −3 +1× 2 −4 +0× 2 −5 )<br />

= −10.4375<br />

in decimal.<br />

□<br />

In many A/D converters and processors, the real numbers are scaled<br />

so that the fixed-point representation is in the (−1, 1) range. This has<br />

the advantage that the multiplication of two fractions is always a fraction<br />

Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).<br />

Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!