1
snick snack
1
CPSC 121: Models of Computation 2016W2
Number Representation Steve Wolfman, based on notes by Patrice Belleville and others
This work is licensed under a Creative Commons Attribution 3.0 Unported License.Outline
- Prereqs, Learning Goals, and Quiz Notes
- Prelude: “Additive Inverse”
- Problems and Discussion
– Clock Arithmetic and Two’s Complement – 1/3 Scottish and Fractions in Binary – Programs and Numbers – Programs as Numbers
- Next Lecture Notes
2
Learning Goals: Pre-Class
By the start of class, you should be able to:
– Convert positive numbers from decimal to binary and back. – Convert positive numbers from hexadecimal to binary and back. – Take the two’s complement of a binary number. – Convert signed (either positive or negative) numbers to binary and back. – Add binary numbers.
3
Learning Goals: In-Class
By the end of this unit, you should be able to:
– Critique the choice of a digital representation scheme—including describing its strengths, weaknesses, and flaws (such as imprecise representation or overflow) —for a given type of data and purpose, such as (1) fixed-width binary numbers using a two’s complement scheme for signed integer arithmetic in computers or (2) hexadecimal for human inspection of raw binary data.
4
Where We Are in The Big Stories
Theory How do we model computational systems? Now: showing that our logical models can connect smoothly to models of number systems. Hardware How do we build devices to compute? Now: enabling our hardware to work with data that’s more meaningful to
- humans. (And once
we have numbers, we can represent pictures, words, sounds, and everything else!)
5
Motivating Problem
Understand and avoid cases like those at: http://www.ima.umn.edu/~arnold/455.f96/disasters.html Death of 28 people caused by failure of an anti-missile system, caused in turn by the misuse of one representation for fractions. Explosion of a $7 billion space vehicle caused by failure of the guidance system, caused in turn by misuse of a 16-bit signed binary value. (Both representations are discussed in these slides.)
6
Photo by Philippe Semanaz (CC by/sa)