Computers and Technology, 21.03.2020 03:03 james2811
To write a C program (not C++) that converts numbers between Decimal and IEEE-754 format and vice versa.
Inputs:
Number in Decimal format (including special case of 0)
Number in IEEE-754 format (including special cases)
Output:
Equivalent number in IEEE-754 format
Equivalent number in Decimal
Specification:
The program converts a number based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:
Decimal to IEEE-754 conversion
IEEE-754 to Decimal conversion
Quit program
Special Cases
The program must also check for these special IEEE cases:
+ 0
- 0
+ infinity
- Infinity
NaN
What to do:
Make sure your code compiles with zyBooks’ zyLabs compiler--if it does not compile with zyBooks’ compiler it will be graded as not compiling, even if it compiles on your compiler on your desktop/laptop at home.
Only 3 submissions will be permitted!
Include all prompts and other messages as shown in the sample run that follows.
Case and whitespaces will be ignored
To mask a number to extract a field, use "variable" & "constant"
To print a number in hexadecimal format, use "%x"
To use the math library, use "include " for functions like "pow(x, y)" to raise "x" to the "y" power
Sample test run
This sample run contains possible cases that will be tested, either individually, in their own Test Bench, or combined in a single Test Bench.
Note:
Inputs in the test run will not show up on the output display. The have been manually included here in BOLD for clarity.
Output result titles are preceded by two asterisks.
Whitespaces and case will be ignored by auto-grading, but all messages must be identical to those shown below in both wording and spelling. This includes any hyphens, asterisks and right-parentheses.
I suggest you use zyLab’s workbench in Develop Mode to pre-test your submissions. That is, make up your own input data and see if you get the correct results.
Test Inputs
These are the input test values. They do not appear on the output of the run.
1
2.5
2
4020000010
2
-126
2
3
Test Output
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit
Enter selection:1
Enter the decimal representation: 2.5
*** Sign: 0
** Biased exponent: 10000000
*** Mantissa: 01000000000000000000000
*** IEEE HEX: 40200000
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit
Enter selection:2
Enter the IEEE-754 representation: 40200000
*** Sign: +
*** Unbiased exponent: 1
*** Normalized decimal: 1.250000
*** Decimal: 2.500000
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit
Enter selection:1
Enter the decimal representation:0
*** Sign: 0
*** Biased exponent: 00000000
*** Mantissa: 00000000000000000000000
***The IEEE-754 representation is: 0.000000
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit
Enter selection:2
Enter the IEEE-754 representation: -126
*** Sign: -
*** Special case: NaN
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit
Enter selection: 2
Enter the IEEE-754 representation:
*** Sign: -
*** Special case: NaN
Floating-point conversion:
1) Decimal to IEEE-754 conversion
2) IEEE-754 to Decimal conversion
3) Exit Enter selection: 3
*** Program Terminated Normally
***ignore anything related to zylabs or zycompiler***
Answers: 1
Computers and Technology, 22.06.2019 19:20
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 2
Computers and Technology, 24.06.2019 04:30
1. web and mobile applications allow users to be actively engaged in an online activity. a true b false 2. some examples of business applications purposes are to collaborate, share files, meet virtually in real-time, and accept payments. a true b false 3. an education application would most likely do which of the following? a allow users to watch popular movies and tv shows b connect users with social and business contacts c confirm users' travel plans d teach users a new language 4. a uniform resource locator (url) is how the internet knows where to take users when an address is typed into a browser. a true b false 5. deon is required to provide the citation information for his sources. what type of information should he collect from his sources? a author name, title, date of publication, date of access, url b connections to background information c interesting facts and statistics d notes on important information
Answers: 1
Computers and Technology, 24.06.2019 18:00
Why is a multiview sketch drawinf different from other sketches like isometric, two point, and oblique
Answers: 1
Computers and Technology, 25.06.2019 14:00
What are the two parts of a cell reference? a. column intersection and row rangeb. column range and row intersectionc. column letter and row numberd. column number and row letter
Answers: 1
To write a C program (not C++) that converts numbers between Decimal and IEEE-754 format and vice ve...
Social Studies, 05.03.2021 07:20
Mathematics, 05.03.2021 07:20
English, 05.03.2021 07:20
Mathematics, 05.03.2021 07:20
Chemistry, 05.03.2021 07:20
Chemistry, 05.03.2021 07:20
Mathematics, 05.03.2021 07:20