I am trying to evaluate a matlab code. A snippet is shown. I am facing an issue with accuracy of digits. I expect the answer to be 0 but get a non-zero value. My entire code deals with many more similar calculations. Is there a way to improve the accuracy of the code. I am using double precision. Any help would be appreciated
Code:
Tw = 306.13;Tsat = 302.63;rho_l = 1440.8;hlv = 126e3;Adis = 2e-21;Pc = (Tw/Tsat - 1)*hlv*rho_l;del1 = (Adis/Pc)^(1/3);Pc - Adis/del1^3 %Expected answer = 0
Best Answer