Chapter 14. Data Representation

Table of Contents

14.. What Everyone Should Know About Data Representation
Practice
14.. Representing Information
Practice
14.. Numeric Limitations of Computers
Practice
14.. Fixed Point Number Systems
Practice
14.. Modular Number Systems
Practice
14.. Binary Data Representation
Practice
14.. Metric and Binary Quantities
Practice
14.. The Arabic Numeral System
Practice
14.. Number Bases
Converting Other Bases to Decimal
Converting Decimal to Other Bases
Practice
14.. Binary Fixed Point
Limitations of Binary
Practice
14.. Binary/Octal/Hexadecimal Conversions
Practice
14.. Unsigned Binary Integers
Introduction
Range
Arithmetic
Practice
14.. Signed Integers
14.. Sign-Magnitude
Format
Negation
Conversions
Addition and Subtraction
Range
Comparison
Practice
14.. One's complement
Format
Negation
Conversions
Addition and Subtraction
Range
Comparison
Practice
14.. Two's Complement
Format
Negation
Another Way to Look at Two's Complement
Addition and Subtraction
Range
Comparison
Overflow Detection
Extension and Reduction
Practice
14.. Biased Notation
Format
Negation
Addition and Subtraction
Range
Comparison
Practice
14.. Hex and Octal with Signed Numbers
Practice
14.. Floating Point
The Basics
Floating Point and Abstraction
A Simple Floating Point Format
Overflow and Underflow
Cost of Floating Point
IEEE Floating Point Formats
Practice
14.. Character Storage
ASCII
ISO
Unicode
Practice

What Everyone Should Know About Data Representation

Computer science students typically spend at least one or two semesters studying computer architecture (hardware design) and machine/assembly language. Most will never become hardware designers, or assembly language programmers, but understanding how data are represented in computer hardware makes all of us better programmers.

Knowing the limitations of computer number systems is necessary in order to write programs that produce correct and precise output and also in writing the most efficient programs possible.

This chapter provides a very brief overview of these limitations. We will cover the standard number systems used by modern computers alongside some historical and hypothetical systems to help put them in context.

Practice

Note

Be sure to thoroughly review the instructions in Section 2, “Practice Problem Instructions” before doing the practice problems below.
  1. What are two advantages of understanding computer data representation if we are not doing hardware design?