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, 03.07.2019 14:10
The y form of iron is known as: a) ferrite b) cementite c) perlite d) austenite
Answers: 3
question
Engineering, 03.07.2019 14:10
Line joining liquid phase with liquid and solid phase mixture is known as: a) liquidus b) solidus c) tie line d) none of the mentioned
Answers: 2
question
Engineering, 03.07.2019 14:10
If the thermal strain developed in polyimide film during deposition is given as 0.0044. assume room temperature is kept at 17.3 c, and thermal coefficient of expansion for the film and the substrate are 54 x 10^-6c^-1 and 3.3 x 10^-6c^-1respectively. calculate the deposition temperature.
Answers: 3
question
Engineering, 04.07.2019 08:10
Which of the following is an easy way to remember the modified “x” tire rotation? a. nondrive wheels straight, cross the drive wheels b. drive wheels straight, cross the nondrive wheels c. drive wheels crossed, nondrive wheels straight d. drive wheels crossed, nondrive wheels crossed
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, 11.04.2020 01:13
question
Mathematics, 11.04.2020 01:13