PHASE #1-Description: Develop a plan to design and finally implement a set of fu
ID: 3349624 • Letter: P
Question
PHASE #1-Description: Develop a plan to design and finally implement a set of functions using C++ that would implement the IEEE standard. Phase 1 will include the literature write up, description of the IEEE 754 (single only) and a complete description of the functions implemented inchuding 1. Functions type void, or any data returning function 2. Type of data passed in to the functions (function parameters or arguments) 3. Type of function parameters (value or reference). 4. Global variables if needed. 5. IEEE 754 single precision layout and its individual parts (sign, exponent, and mantissa) details. 6. The hexadecimal layout of both precision. Work out a full example from A to Z. 7. SUGGESTED FUNCTIONS PLAN MENU To display the user options... SPLITTER To split the number to whole and fraction WHOLECONVERTER Whole Part binary converter FRACTIONCONVERTER Fraction Part binary converter CONCATENATOR Concatenate STANDARDIZER Normalizes the binary umber to standard form DISPLAY Display the resultExplanation / Answer
C++ program
#include <limits.h>
#include <iostream>
#include <math.h>
#include <bitset>
int Binary 2 Hex ( std :: string Binary)
{
std:: bitset <32> set(Binary);
int hex = set.to_ulong();
return hex;
}
float getfloat 32(std::string Binary)
{
int HexNumber = Binary2 Hex (Binary);
bool negative == ( HexNumber & 0x80000000);
int exponet = (Hexnumber & 0x7f800000)>> 23;
int sign = negative ? -1:1;
exponent = -127;
int power =-1;
float total =0.0;
for ( int i=0; i<23; i++
{int c= Binary [ i+a ]-0;
Total t=(float)c*(float pow (2.0,power);
Power--;
}
total += 1.0;
float value = sign (float)pow(2.0, exponent)* total;
return value;
}
std :: string GetBinary 32(floatvalue)
{
union
{
float input;
int output;
)
data;
data.input = value ;
}
int main ()
{
std :: string str = GetBinary32 (float ) 19.5;
std :: cout << Binary Equivalent of 19.5 ;" << std :: endl;
std :: cout << str << st:: endl<< std:: endl;
float f = Get float 32(str);
std :: cout << " decimal equivalent of " << str<< " : " << std :: endl;
std :: cout << f << std :: endl;
return0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.