Question: In this assignment, you'll write a program that will further familiarize you with floating - point numbers and how the operating system treats memory. I

In this assignment, you'll write a program that will further familiarize you with floating-point numbers and how the operating system treats memory.
I strongly encourage you to review the page It's Just Memory before spending time on this assignment.
I also encourage you to review the page Processing the command line and the examples I have provided in ~rchaney/Classes/cs205/src/argc_argv, especially the example file getopt_long.c. Using the long options with getopt() is considerably more challenging that simple short options. Completing Activity 07 will give you an opportunity to focus on a small example of the use of getopt_long(). Here are a couple additional examples of using getopt_long():
The GNU example
Linux man page (this is the same as the man page on ada)
Some Wordpress site
What you must do
Write a program that performs the following tasks. Command line flags should be used to determine which option to run. See man getopt_longLinks to an external site. for details on how to do this. All floating point formats are IEEE 754 unless otherwise noted.
Read in a hex value, and interpret it as a single precision floating point value. (--hex-float, -x)
Read in a hex value, and interpret it as a double precision floating point value. (--hex-double, -X)
Read in a floating point value, and return the hex representation of it in single precision. (--float-hex, -f)
Read in a floating point value, and return the hex representation of it in double precision (--float-double, -d)
Read in a double precision floating point value, and print the following interpretations of the bit pattern (--print, -p):
A string of characters2 consecutive floating point valuesThe hex representation of the value232-bit signed integers
little-endianbig-endian
232-bit unsigned integers
little-endianbig-endian
164-bit signed integer
little-endianbig-endian
164-bit unsigned integer
little-endianbig-endian
Your program must have a --help option which shows usage.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!