Hi all,
I have a nasty problem with floating point arithmetic.
Let E be a double variable which is assigned a value using an expression like:
E=A+B*((i<j) ? f(C1)/(1-f(C2)) : 0);
where A,B,C1,C2 are double variables, f is a function returning a double and i,j are integers.
The problem I have is that the value assigned to E is 'nan' but when I use
printf("E=%f\n",A+B*f(C1)/(1-f(C2)));
the actual value of E (which is in the range [-5,5]) appears correctly! It seems that there is a problem during the assignment.
Any help will be welcome,
Mike
I have a nasty problem with floating point arithmetic.
Let E be a double variable which is assigned a value using an expression like:
E=A+B*((i<j) ? f(C1)/(1-f(C2)) : 0);
where A,B,C1,C2 are double variables, f is a function returning a double and i,j are integers.
The problem I have is that the value assigned to E is 'nan' but when I use
printf("E=%f\n",A+B*f(C1)/(1-f(C2)));
the actual value of E (which is in the range [-5,5]) appears correctly! It seems that there is a problem during the assignment.
Any help will be welcome,
Mike