Numerical Computing with IEEE Floating Point Arithmetic

Chapter 3: Computer Representation of Numbers

What is the best way to represent numbers on the computer? Let us start by considering integers. Typically, integers are stored using a 32-bit word, so we confine our attention to this case. If we were concerned only with nonnegative integers, the representation would be easy: a bitstring specifying the binary representation of the integer. For example, the integer 71 (see (2.1)) would be stored as


The nonnegative integers that we can represent in this way range from 0 (a bitstring of 32 zeros) to 2 32 ? 1 (a bitstring of 32 ones). The number 2 32 is too big, since its binary representation consists of a one followed by 32 zeros.

Signed Integers via 2's Complement

In fact, we need to be able to represent negative integers in addition to positive integers and 0. The most obvious idea is sign-and-modulus: use one of the 32 bits to represent the sign, and use the remaining 31 bits to store the magnitude of the integer, which may then range from 0 to 2 31 ? 1. However, nearly all machines use a more clever representation called 2's complement. [5] A nonnegative integer x, where 0 ? x ? 2 31 ? 1, is stored as the binary representation of x, but a negative integer ? y, where 1 ? y ? 2 31, is stored as the binary representation of the positive integer


For example, the integer

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Digital Parallel and Serial Converters
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.