Skip to main content

2015 | Buch

Numbers and Computers

insite
SUCHEN

Über dieses Buch

This is a book about numbers and how those numbers are represented in and operated on by computers. It is crucial that developers understand this area because the numerical operations allowed by computers, and the limitations of those operations, especially in the area of floating point math, affect virtually everything people try to do with computers. This book aims to fill this gap by exploring, in sufficient but not overwhelming detail, just what it is that computers do with numbers.

Divided into two parts, the first deals with standard representations of integers and floating point numbers, while the second details several other number representations. Each chapter ends with exercises to review the key points. Topics covered include interval arithmetic, fixed-point numbers, floating point numbers, big integers and rational arithmetic.

This book is for anyone who develops software including software engineerings, scientists, computer science students, engineering students and anyone who programs for fun.

Inhaltsverzeichnis

Frontmatter

Standard Representations

Frontmatter
Chapter 1. Number Systems
Abstract
Computers use number bases other than the traditional base 10. In this chapter we take a look at number bases focusing on those most frequently used in association with computers. We look at how to construct numbers in these bases as well as how to move numbers between different bases.
Ronald T. Kneusel
Chapter 2. Integers
Abstract
Integers are perhaps the most important class of numbers. This is certainly true in the case of computers. In this chapter we dive into the integers and how computers represent and operate on them. Without these operations, digital computers would not function. We begin with some preliminary notation and terminology. Next we take a detailed look at the unsigned integers. We follow this with an examination of negative integers and their operations. Lastly, we finish with a look at binary coded decimals.
Ronald T. Kneusel
Chapter 3. Floating Point
Abstract
We live in a world of floating-point numbers and we make frequent use of floating-point numbers when working with computers. In this chapter we dive deeply into how floating-point numbers are represented in a computer. We briefly review the distinction between real numbers and floating-point numbers. Then comes a brief historical look at the development of floating-point numbers. After this we compare two popular floating-point representations and then focus exclusively on the IEEE 754 standard. For IEEE 754 we consider representation, rounding, arithmetic, exception handling, and hardware implementations. We conclude the chapter with some comments about the pitfalls associated with using floating-point numbers.
Ronald T. Kneusel

Other Representations

Frontmatter
Chapter 4. Big Integers and Rational Arithmetic
Abstract
Big integers differ from standard integers in that they are of arbitrary size; the number of digits used is limited only by the memory available. In this chapter we look at how big integers are represented in memory and how to perform arithmetic with them. We also discuss some implementations which might be of use when using programming languages that do not support big integers natively. Next we examine rational arithmetic with big integers. Finally, we conclude with some advice on when it might be advantageous to use big integers and rational numbers.
Ronald T. Kneusel
Chapter 5. Fixed-Point Numbers
Abstract
Fixed-point numbers implement floating-point operations using ordinary integers. This is accomplished through clever use of scaling and allows systems without explicit floating-point hardware to work with floating-point values effectively. In this chapter we explore how to define and store fixed-point numbers, how to perform signed arithmetic with fixed-point numbers, how to implement common trigonometric and transcendental functions using fixed-point numbers, and, lastly, discuss when one might wish to use fixed-point numbers in place of floating-point numbers.
Ronald T. Kneusel
Chapter 6. Decimal Floating Point
Abstract
Decimal floating-point is an emerging standard which uses base 10 instead of base 2 to represent floating-point numbers. In this chapter we will take a look at how decimal floating-point numbers are stored using the IEEE 754-2008 standard as our reference. We will then look at a C language software implementation of decimal floating-point which conforms to the IEEE standard and give some examples of its use. We follow this with a look at the Python decimal library. We end with some thoughts on decimal floating-point and its use.
Ronald T. Kneusel
Chapter 7. Interval Arithmetic
Abstract
Floating-point numbers do not map exactly to the real numbers. Also, sometimes there are uncertainties in our knowledge of the true value for a quantity. Both of these situations can be addressed by using interval arithmetic which keeps bounds on the possible value of a number while a calculation is in progress. In this chapter we will describe interval arithmetic, implement basic operations for interval arithmetic in C, discuss functions as they pertain to intervals, examine interval implementation for C and Python, and finally offer some advice on when to use interval arithmetic.
Ronald T. Kneusel
Backmatter
Metadaten
Titel
Numbers and Computers
verfasst von
Ronald T. Kneusel
Copyright-Jahr
2015
Electronic ISBN
978-3-319-17260-6
Print ISBN
978-3-319-17259-0
DOI
https://doi.org/10.1007/978-3-319-17260-6