Computers and Technology
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***

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:30, raytaylorh010801
Write a computer program to calculate the three-phase fault current for a fault at f in figure 1.16, with the network normal, and with one line at a time removedproblems 1.1 write a computer program to calculate the three-phase fault current for a fault at f in figure 1.16, with the network normal, and with one line at a time removed 20 power system relaying from service. the positive-sequence impedance data are given in the accompanying table. use the commonly made assumption that all prefault resistance values are (1.0+j0.0) pu, and neglect all resistance values. calculate the contribution to the fault flowing through the cb b and the voltage at that bus. for each calculated case, consider the two possibilities: cb b2 closed or open. the latter is known as the stub-end fault í• figure 1.16 problem 1.1 system data for figure 1.16 from to positive sequence 0.0+j0.1 0.05j0.15 0.04 j0.2 0.01 jo. i 0.015 + j0.15 0.01 j0.19 0.01 +j0.19 0.03+j0.1 0.0+j0.08 6 6 6 from service. the positive-sequence impedance data are given in the accompanying table. use the commonly made assumption that all prefault resistance values are (1.0 + j 0.0) pu, and neglect all resistance values. calculate the contribution to the fault flowing through the cb b1, and the voltage at that bus. for each calculated case, consider the two possibilities: cb b2 closed or open. the latter is known as the “stub-end” fault.
Answers: 2
image
Computers and Technology, 22.06.2019 07:00, yyy77uh
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e. g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
image
Computers and Technology, 22.06.2019 15:30, mariap3504
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, bernicewhite156
Select the correct answer. what does it indicate when a website displays https instead of http? a. the website is secure. b. there is no secure sockets layer. c. the secure sockets layer is hidden. d. the website is not secure.
Answers: 1
Do you know the correct answer?
To write a C program (not C++) that converts numbers between Decimal and IEEE-754 format and vice ve...

Questions in other subjects:

Konu
Mathematics, 10.12.2020 19:00