Is there any standard function available which can help me to compare the max()
or min()
between two float values ?
I have written the fixed point implementation for this min()
and max()
function from q0s32
to q32s0
type (33 types).
But I want to test the precision loss of my function with the std:min()
and std::max()
function .But results are not good from std functions .
I tried this way, but that did not work for me as result is not as per the expectation .
Code :
float num1 = 4.5000000054f;
float num2 = 4.5000000057f;
float resf = std::max(num1,num2);
printf("Result is :%20.15f\n",resf);
printf("num1 :%20.15f and num2 :%20.15f\n",num1,num2);
Output:
Result is : 4.500000000000000
num1 : 4.500000000000000 and num2 : 4.500000000000000