Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 5. Based on the required reading, write a C program to implement your own floating-point data-type, MyFloat. Recall that a float has 32-bits: 1
Exercise 5. Based on the required reading, write a C program to implement your own floating-point data-type, MyFloat. Recall that a float has 32-bits: 1 bit for sign, 8 bits for exponent, and 23 bits for significand/mantissa (plus 1 implicit bit). You may declare a struct for MyFloat with three data items: variable for sign-bit, dynamic array for exponent, and a dynamic array for significand. Your program must accept a:s command line arguments the number of bits to use for the exponent and significand (number of sign bits is always one). Similar to the last exercise, the program then asks the user for a signed decimal number, which is then converted to the internal bit representation of MyFloat. For example, assuming MyFloat is the same as float, i.e., 1 sign bit, 8 exponent bits, 23 signficand bits, the decimal number 103.2510 is equal to 0 10000101 10011101000000000000000 where green bit is the sign bit, blue bits are the exponent bits, and red bits are the significand bits
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started