CMPT 295 Assignment 2 solved

$30.00

Original Work ?

Download Details:

  • Name: assignment-2-lohup8.zip
  • Type: zip
  • Size: 63.17 KB

Category: Tags: , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

 

  1. [8 marks] Floating point conversion and Rounding.
  2. Represent the following numbers in IEEE floating point representation (single precision), clearly showing the effect of rounding on the “frac” (mantissa), if rounding occurs, and express your final answer in binary and in hexadecimal:
  3. 0.0011111112
  4. 3.141601562510
  • 0.910
  1. 1/310 (a third)
  2. Convert 0x4AEA4C1A from IEEE floating point representation (single precision) to a real number.
  3. Round the following binary numbers (rounding position is bolded – 2-4 position) following the rounding rules of the IEEE floating point representation.
  4. 1.00111112
  5. 1.10010012
  • 1.01111002
  1. 1.01101002

For each of the above rounded binary numbers, indicate what type of rounding you performed and compute the value that is either added to or subtracted from the original number (listed above) as a result of the rounding process. In other words, compute the error introduced by the rounding process.

  1. [12 marks] Creating hypothetical smaller floating-point representations based on the IEEE floating point format allows us to investigate this encoding scheme more easily, since the numbers are easier to manipulate and compute.

Below is a table listing several real numbers represented as 6-bit floating-point numbers (w = 6). The format of these 6-bit floating-point numbers is as follows: 1 bit is used to express for the sign, 3 bits are used to express “exp” (k = 3) and 2 bits are used to represent “frac” (n = 2), in the following order: sign  exp   frac.

Complete the table (the same way as in Figure 2.35 in our textbook) then answer the questions below the table.

Tip: Have a look at Figure 2.35 in our textbook, which illustrates a similar table for a hypothetical 8-bit floating-point format. This will give you an idea of how to complete the table. Also, Figure 2.34 displays the complete range of these 6-bit floating point numbers as well as their values between -1.0 and 1.0. This diagram may be helpful when you are checking your work.

 

  Exponent Fraction Value
Description Bit representation exp E 2E frac M M  2E V Decimal
zero 0 000 00             0 0.0
Smallest positive denormalized 0 000 01                
  0 000 10                
Largest positive

denormalized

0 000 11                
Smallest positive normalized 0 001 00                
  0 001 01                
  0 001 10                
  0 001 11                
  0 010 00                
  0 010 01                
  0 010 10                
  0 010 11                
One 0 011 00               1.0
  0 011 01                
  0 011 10                
  0 011 11                
  0 100 00                
  0 100 01                
  0 100 10                
  0 100 11                
  0 101 00                
  0 101 01                
  0 101 10                
  0 101 11                
  0 110 00                
  0 110 01                
  0 110 10                
Largest positive

normalized

0 110 11                
+ Infinity   _ _ _ _ _ _   _
NaN   _ _ _ _ _ _ NaN _
  1. What is the value of the bias?
  2. Consider two adjacent denormalized numbers. How far apart are they? Expressed this difference (“delta”) as a decimal number.
  3. Consider two adjacent normalized numbers …
    1. with the exp field set to 001. How far apart are they?
    2. with the exp field set to 010. How far apart are they?
    3. with the exp field set to 011. How far apart are they?

Expressed these differences (“delta”) as decimal numbers.

  1. Without doing any calculations, can you guess how far apart are two adjacent normalized numbers …
    1. with the exp field set to 100?
    2. with the exp field set to 101?
    3. with the exp field set to 110?
  2. What is the “range” (not contiguous) of real numbers that can be represented using this 6-bit floating-point representation?
  3. What is the range of the normalized exponent E (E found in the equation v = (-1)s M 2E ) which can be represented by this 6-bit floating-point representation?
  4. Give an example of a real number that cannot be represented using this 6-bit floating-point representation, but is within the “range” of representable values.
  5. Give an example of a real number that would overflow if we were trying to represent it using this 6-bit floating-point representation. The best way to answer this question is to convert this real number into a 6-bit IEEE floating-point representation and clearly indicate why it would overflow.
  6. How close is the value of the “frac” of the largest normalized number to 1? In other words, what is ε (epsilon)? Expressed it as a decimal number.