I have the following codes. Naturally, I expect to get zero. I thought it is due to some possible issues stated as "Machine-precision inputs can give numerically wrong answers on branch cuts:".
In[526]:= w0 /. iNputIsoDaMax3Ethanol
Out[526]= 1.19498
In[528]:= fool[q_?NumericQ, p_?NumericQ] := Log[q/p]
In[529]:= fool[w0, w0] /. iNputIsoDaMax3Ethanol
Out[529]= -1.11022*10^-16
How can I code so that it gives 0 when the inputs are same within some precision.
Thank you.
0.
Try removing?NumericQ
from definition offool
, i.e.,fool[q_, p_] := Log[q/p]
Since 'fool` does not use numeric techniques, there is no reason to restrict its arguments. Otherwise do as @bills suggests. $\endgroup$