I am doing fixed point implementation and i am running the test and i am trying to check the precision of my fixedpoint operations with the precision of operations from cmath header.
so here is my is code in test.cpp
#include <fixed_point_header.h>
#include <stdio.h>
int main()
{
float fp1 = 3.14159;
float fp2 = 4.1723;
float fp3,fp4,fp5,fp6;
fp3 = fp1+fp2;
fp4 = fp1-fp2;
fp5 = fp1*fp2;
fp6 = fp1/fp2;
printf("float fixed point summation data ==%f\n",fp3);
printf("float fixed point difference data ==%f\n",fp4);
printf("float fixed point multiplied data ==%f\n",fp5);
printf("float fixed point divided data ==%f\n",fp6);
}
the above code is tested fine, but now i need to calculate the same operations and see the results from cmath header in the same test.cpp file. so how do i proceed, is it possible with the two namespaces ( one namespace of my header file, one namespace std)?
like
#include <fixed_point_header.h>
#include <stdio.h>
#include <math.h>
using namespace fp;
int main() {
...// do the fixedpoint operations here
}
using namespace std;
int main() {
...// do the cmath operations here
}
Is it possible like the above code, can someone help how to proceed with it.
Thanks