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 12:30
What is the difference between the internet and the world wide web?
Answers: 1
question
Computers and Technology, 24.06.2019 00:40
What social factors affect your health
Answers: 3
question
Computers and Technology, 24.06.2019 03:40
4. does the kernel phenotype distribution support the idea that the cob is the result of a dihybrid cross? what information supports your answer? if a dihybrid cross (i.e. f1 to f2 of standard mendelian crosses) is not indicated what conditions might contribute to this finding.
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
Atype of researcher who uses computers to make sense of complex digital data
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
Mathematics, 27.09.2020 16:01
question
Social Studies, 27.09.2020 16:01