Question: #include #include #include using namespace std; /*we use union and structure for IEEE 754 REPRESENTATION*/ typedef union { float f; struct { unsigned int mantissa

#include #include #include using namespace std; /*we use union and structure for IEEE 754 REPRESENTATION*/ typedef union { float f; struct { unsigned int mantissa : 23; unsigned int exponent : 8; unsigned int sign : 1; } raw; } myfloat;

/*for converting float to binary*/ void floattobinary(float f) { int bit=0; int *b = reinterpret_cast(&f); cout>31)&1)=23; k--) { bit = ((*b >> k)&1); cout =23; k--) { bit = ((*b >> k)&1); cout

/*for converting into base 10*/ int base10(int n,int i) { long int x=pow(2,i-1); long int sum=0; for (int k = i - 1; k >= 0; k--) {

if ((n >> k) & 1) sum+=x; x/=2; } return sum; }

/*for convert into hexadecimal from base 10*/ int hexadecimal(int x,int z) { int n=base10(x,z); char hexaDeciNum[100]; int i = 0; while(n!=0) { int temp = 0; temp = n % 16;

if(temp

n = n/16; } for(int j=i-1; j>=0; j--) cout

/*for printing binary*/ void printBinary(int n, int i) { int k; for (k = i - 1; k >= 0; k--) {

if ((n >> k) & 1) printf("1"); else printf("0"); } }

/*for printing in IEEE 754 representation*/ void printIEEE(myfloat var) {

printf("%d | ", var.raw.sign); printBinary(var.raw.exponent, 8); printf(" | "); printBinary(var.raw.mantissa, 23); printf(" "); }

int main() { myfloat var; float x,n; cout>x; var.f=x; cout>ch; switch(ch) { case 1: if(var.raw.sign==1) cout 0) { binaryNum[l] = y % 2; y = y / 2; l++; } for (int j = 7; j >= 0; j--) cout

Using the code above break down/describe each function for the lab description below

#include #include #include using namespace std; /*we use union and structure for

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 floating and a complete description of the functions plan: 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 double precision layout and its individual parts (sign, exponent, and mantissa) details. 6. The hexadecimal layout. 7. Hand work out two or three example from A to Z based on your team size. 8. Use your and your partner SIS ID numbers as examples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!