I have the following code :
func(double val) {
// I am trying with the following values. both of which are in the range as per
// IEEE 754 std.
// val = 1.847474
int temp = [some_val = (1 << 23)];
double temp2 = val * temp;
printf("the produt111a = %15f\n",temp2);
}
value in temp2
results in loss of precision.
However, if I directly substitute the value of val
while doing multiplication I got the correct result.
What can be done to avoid precision loss in such a scenario?