- for lecturer: tutorial 2

- integer representation, addition, subtraction, multiplication, division
- real number represetation (in IEEE 754)
- 1st homework

- logic operations (and, or, invert, rotation, …)
- two's complement code and IEEE 754.
- to understand the program from the last class.

The aim of today's exercise is representation of real and integer numbers in computer and arithmetical operations with them.

- Integer addition and subtraction in two's complement representation
- add and subtract two integer numbers. For example 5+(-6) and 5-(-6).
- repeat the operations with different numbers and check your results with the computer program from the first exercise.
- When the underflow and overflow can happen? How can we detect, that it had occured?

- Integer multiplication
- multiply two integers, For example 7*6.
- is there any difference when multiplying negative numbers? (e.g. -7*6, (-7)*(-6), etc…)
- show how to speed-up the multiplier? (use many adders instead repetitively using one).

- Integer division
- divide integers 42/7, 43/7
- does the algorithm change when we use negative numbers?

- Real number representation (IEEE 754)
- binary representation of real numbers (float - 32bit, double - 64bit)
- show binary representation of -0.75. Check your result with program from the last exercise.
- find decimal number for float binary number 0xC0A00000 in IEEE754.
- explain who to add numbers 9.999*10^1 and 1.1610*10^(-1) in decimal representation. Assume that it is possible to store only 4 digits in mantisa and 2 digits in exponent.
- Hint: 1) align numbers 2) addition 3) normalization 4) round numbers.

- in binary representation add 0.5 and -0.4375
- in decimal representation show multiplication of 1.110*10^10 * 9.200*10^(-5)
- in binary representation multiply 0.5 and -0.4375

* gcc/config/fp-bit.c - Implementation of float point operations with real numbers using fixed point arithmetic as used in GCC compiler. Used on processors without hardware floating point support.

courses/b35apo/en/tutorials/02/start.txt · Last modified: 2018/02/11 17:30 (external edit)