AMATH 483 / 583 – HW1 solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

1 Problems

1. Write a C or C++ program that finds a practical measure of your machine’s SP (32 bit) and DP (64 bit) precision by taking the difference of 2 numbers and comparing the result to zero in each data type. You will submit the code, and in the written homework will state the values you obtained running your code for each data type.

You may find https://www.w3schools.com/cpp/cpp_while_loop.asp useful if you are beginning in C++ programming.Use while and iterate on j = 0, 1, . . . . Hint: while ( ( 1−(1+ 1 2 j ) ̸= 0 ) {. . . j++;}

2. What are the largest and smallest SP (32 bit) and DP (64 bit) numbers that can be represented in IEEE arithmetic? Show your work as this is analytic.

3. Write a C or C++ program to multiply the integers 200*300*400*500 on your computer? What is the result? You will submit the code, and in the written homework will name the effect you observed AND provide a definition and math formula for underflow and overflow for IEEE SP and DP representations.

4. How many SP (32 bit) normalized floating point numbers are there? Same question for DP (64 bit). Provide a math formula and show your work. 5. Consider a 6 bit floating point system with one sign bit (s = 1), a 3-bit exponent (k = 3), and a 2-bit mantissa (n = 2).

Enumerate by hand all the representable normalized and denormalized numbers. Plot the distribution of the representable numbers on a line. I gifted you a head start in the support materials section. Other Read Lumsdaine’s problem set 1: https://amath583.github.io/sp21/assignments/ps1.html Create a directory (folder) named hw1 .

Put a copy of your written solutions in a single .pdf file, and your two C or C++ computer programs for problems 1 and 3 in the directory. From a terminal (SHELL) please issue the command: tar -cvf hw1 .tar hw1 . You will submit the file hw1 .tar to Canvas for grading. 1 2 Support Materials 2 3