Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3: The following piece of code shows a problem with using IEEE 754 single-precision floating point representation. The code is written in the C

image text in transcribed

Question 3: The following piece of code shows a problem with using IEEE 754 single-precision floating point representation. The code is written in the C programming language. It declares an integer variable named i and assigns it a value of 16777217. It then declares another variable (named x) of floating point type and assigns it the value of i after converting i to a floating point value. Finally, it prints i and x You need to compile this code to see its output. UWWUTUUI1 #include int main) unsigned int i16777217; float x - (float)i; printf ("%d\t%d", i, (int) x); BRBBRBRB Note that x = (float) i converts the integer i to a floating-point value and (int) x converts the floating-point value back to an integer. Many C compilers that can run this code directly are available on the Internet. Search for an "online c compiler" in google. Then copy and paste the above code in one of those compilers. Run (or Execute) the code to see its output. Examine the output carefully, then answer the following questions. The first number in the output represents an integer and the second number represents an IEEE 754 floating-point representation of that integer. Are the two numbers same or different? Convert the number 16777217 to IEEE 754 floating point format manually. Then convert the second number to IEEE 754 format. Which number were you able to convert successfully? What could be a possible reason for the difference between the values that are printed out by the above program? 1. 2. 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

Discuss cross-cultural differences in perception

Answered: 1 week ago

Question

Spell out the full name of the compound

Answered: 1 week ago

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago

Question

7. Determine what feedback is provided to employees.

Answered: 1 week ago