Untitled
By: a guest | Feb 4th, 2010 | Syntax:
C++ | Size: 0.62 KB | Hits: 68 | Expires: Never
void mult_unit(string fp1, string fp2)
{
double exp1=-1, exp2=-1;
long double temp1=0, temp2=0, temp3=0;
for(int a=0; a<23; a++)
{
if(fp1[a]=='1')
temp1 += pow(2, exp1);
exp1--;
}
cout << "temp1 = " << temp1 << endl;
for(int a=0; a<23; a++)
{
if(fp2[a]=='1')
temp2 += pow(2, exp2);
exp2--;
}
cout << "temp2 = " << temp2 << endl;
temp3 = temp1 * temp2;
cout << "temp3 = " << temp3 << endl;
}