hello all, i am implementing a fixedpoint arthimetic and i am doing a test for division in my test.cpp file. the following is the code for the test division,
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
#include <fixed_point_header.h>
int main()
{
fp::fixed_point<int, 15> fp1 = 32767;
fp::fixed_point<int, 15> fp2 = 3.1415926535;
fp::fixed_point<int, 15> fp3;
fp3 = fp1/fp2;
std::cout<<"fixed point divided data =="<<fp3<<std::endl;
}
now i would like to add more detail to my results, by comparing my fixedpoint result with c++ double precision results ie.finding the difference between the two results, like below code
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int main()
{
fp::fixed_point<int, 15> fp1 = 32767;
fp::fixed_point<int, 15> fp2 = 3.1415926535;
fp::fixed_point<int, 15> fp3;
double a = 32767;
double b = 3.1415926535;
double c, difference;
fp3 = fp1/fp2;
c=a/b;
//difference= cast template class to double and subtract with double c
}
can some one help me to proceed with how to do casting of template class and subtract with c++ double.