subject
Engineering, 24.03.2020 01:23 mariap3504

Programming Assignment 2 Decimal and IEEE-754 ConversionsObjective: 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 DecimalSpecification:The program converts a number based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) Quit programSpecial Cases The program must also check for these special IEEE cases: • + 0 • -0 • + infinity • - Infinity • NaNSample test runThis sample run contains all possible cases that will be tested, either individually, in their own Test Bench, or combined in a single Test Bench. Test Inputs These are the input test values. They do not appear on the output of the run.1 2.5 2 40200000 1 0 2 -126 2 3Test OutputFloating-point conversion:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:Enter the decimal representation:*** Sign: 0 *** Biased exponent: 10000000 *** Mantissa: 01000000000000000000000 *** IEEE HEX: 40200000Floating-point conversion:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:Enter the IEEE-754 representation:*** Sign: + *** Unbiased exponent: 1 *** Normalized decimal: 1.250000 *** Decimal: 2.500000Floating-point conversion: -1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:Enter the decimal representation:*** Sign: 0 *** Biased exponent: 00000000 *** Mantissa: 00000000000000000000000***The IEEE-754 representation is: 0.000000Floating-point conversion:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:Enter the IEEE-754 representation:*** Sign: - *** Special case: NaNFloating-point conversion:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:Enter the IEEE-754 representation:*** Sign: - *** Special case: NaNFloating-point conversion:1) Decimal to IEEE-754 conversion 2) IEEE-754 to Decimal conversion 3) ExitEnter selection:*** Program Terminated Normally"Assignment 2 Skeleton"#include #include //void "OPTION #1"(){ /* declare local variables */ /* prompt for floating point decimal number */ /* Check for 0--if so, print result */ /* Print sign: if number>0, sign is 0, else 1 */ /* take absolute value of number before generating significand */ /* Normalize number: while number >2, divide by 2, increment exponent while number <1, multiply by 2, decrement exponent */ /* Bias exponent by 127 and print each bit in binary with 8-iteration for-loop*/ /* Hide 1 and print significand in binary with 23-iteration for-loop*/ /* Print IEEE-754 representation */return;}//void "OPTION #2"(){/* declare local variables *//* prompt for IEEE-754 representation */ /* check for special cases: 0, -0, +infinity, -infinity, NaN, if so, print and return */ /* Mask sign from number: if sign=0, print "+", else print "-" */ /* Mask biased exponent and significand from number */ /* If biased exponent=0, number is denormalized with unbiased exponent of -126, print denormalized number as fraction * 2^(-126), return */ /* Unbias exponent by subtracting 127 and print */ /* Add hidden 1 and print normalized decimal number */ /* Print decimal number */ return;}int main(){/* declare local variables *//* until user chooses to quit, prompt for choice and select appropriate function */return 0;}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Apump is used to circulate hot water in a home heating system. water enters the well-insulated pump operating at steady state at a rate of 0.42 gal/min. the inlet pressure and temperature are 14.7 lbf/in.2, and 180°f, respectively; at the exit the pressure is 60 lbf/in.2 the pump requires 1/15 hp of power input. water can be modeled as an incompressible substance with constant density of 60.58 lb/ft3 and constant specific heat of 1 btu/lb or. neglecting kinetic and potential energy effects, determine the temperature change, in °r, as the water flows through the pump.
Answers: 1
question
Engineering, 04.07.2019 18:10
Ariver flows from north to south at 8 km/h. a boat is to cross this river from west to east at a speed of 20 km/h (speed of the boat with respect to the earth/ground). at what angle (in degrees) must the boat be pointed upstream such that it will proceed directly across the river (hint: find the speed of the boat with respect to water/river)? a 288 b. 21.8 c. 326 d. 30.2
Answers: 3
question
Engineering, 04.07.2019 19:10
A)-explain briefly the importance of standards in engineering design. b)- what is patent? c)-explain the relationship between these standards: b.s. and b.s.en d)- in engineering design concepts, types of loads and how they act are important factors. explain.
Answers: 3
question
Engineering, 04.07.2019 19:20
Acircular pipe of 30mm outside diameter is placed in an airstream at 30 c and latm pressure. the air moves in cross flow over the pipe at 20 m/s, while the outer surface of the pipe is maintained at 110 c. what is the drag force exerted on the pipe per unit length? what is the rate of heat transfer from the pipe per unit length?
Answers: 1
You know the right answer?
Programming Assignment 2 Decimal and IEEE-754 ConversionsObjective: To write a C program (not C++) t...
Questions
question
Mathematics, 29.05.2021 06:20
question
Mathematics, 29.05.2021 06:20
question
History, 29.05.2021 06:20
question
Mathematics, 29.05.2021 06:20
question
Mathematics, 29.05.2021 06:20
Questions on the website: 13722363