subject

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***

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
You can apply several different worksheet themes from which tab?
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
question
Computers and Technology, 24.06.2019 08:10
Where are american poets found in the dewey decimal system
Answers: 1
You know the right answer?
To write a C program (not C++) that converts numbers between Decimal and IEEE-754 format and vice ve...
Questions
question
Biology, 26.03.2021 22:10
question
English, 26.03.2021 22:10
question
Mathematics, 26.03.2021 22:10
question
Mathematics, 26.03.2021 22:10
Questions on the website: 13722360