Professional Documents
Culture Documents
txt
============================================
Notes and answers for Lab 04 (computer math)
============================================
- Ian! D. Allen - idallen@idallen.ca - www.idallen.com
Text References: ECOA2e Section 2.3, 2.4
Class Notes: http://teaching.idallen.com/cst8214/07f/
binary_math.txt
Binary Mathematics, unsigned, two's complement, etc.
hexadecimal_conversions.txt
Converting to/from hexadecimal (base 16)
overflow.txt
Calculating the OVERFLOW flag in binary arithmetic
You can check your work using any online converter; use Google to find one.
e.g. http://www.tonymarston.net/php-mysql/converter.php
A quiz is here: http://acc6.its.brooklyn.cuny.edu/~gurwitz/core5/binquiz.html
Base 36: http://www.cut-the-knot.org/recurrence/word_primes.shtml
Many bases: http://www.cut-the-knot.org/binary.shtml
1.Write down all the negative powers of two from zero ("1") to -4 ("0.0625").
1 0.5 0.25 0.125 0.0625
2.Convert 0.34375 to 0.0101 binary, stopping at four fractional bits
(ECOA2e Example 2.7 p.45).
3.Convert 6235 octal to C9D hexadecimal (ECOA2e Example 2.9 p.46).
6235 = 110 010 011 101 = 1100 1001 1101 = C9Dh
4.What are the largest and smallest integers an 8-bit word can hold
using a sign-magnitude representation? (p.47)
+ 2**7 - 1 = +127
- 2**7 - 1 = -127
5.What are the largest and smallest integers an 8-bit word can hold
using a one's complement representation?
+ 2**7 - 1 = +127
- 2**7 - 1 = -127
6.What are the largest and smallest integers an 8-bit word can hold
using a two's complement representation?
+ 2**7 - 1 = +127
- 2**7
= -128
7.What are the largest and smallest integers a 16-bit word can hold
using a two's complement representation?
+ 2**15 - 1 = +32,767
- 2**15
= -32,768
1 of 3
8/13/2008 10:52 AM
http://teaching.idallen.com/cst8214/07f/notes/lab04notes.txt
-OR-
2 of 3
8/13/2008 10:52 AM
http://teaching.idallen.com/cst8214/07f/notes/lab04notes.txt
3 of 3
8/13/2008 10:52 AM