MATLAB: Do I get different numerical answers for symbolic math results using “double” and “eval”

doubleevalmathprecisionsymbolicSymbolic Math Toolbox

I am using Symbolic Math Toolbox to solve following equation and get the result "s".
>> syms x;
>> s = solve(-x*log(x)-0.35)
s =
-7/(20*wrightOmega(log(7/20) - pi*1i))
-7/(20*wrightOmega(log(7/20) + pi*1i))
To get the answer as floating point number, I tried following two approaches:
Case 1: Using "double" or "vpa" gives the correct answer.
>> double(s)
ans =
0.2593
0.4884
>> vpa(s,4)
ans =
0.2593
0.4884
Case 2: Using "eval" or directly evaluating expression in command window gives incorrect answer for first value.
>> eval(s)
ans =
0.0168 - 0.0399i
0.4884 + 0.0000i
>> -7/(20*wrightOmega(log(7/20) - pi*1i))
ans =
0.0168 - 0.0399i
Both approaches should give the same answer. Can you please explain this strange behavior?

Best Answer

This is due to precision and round-off error. When approximating a value numerically, floating-point results can be sensitive to the precision used and prone to round-off errors. Converting symbolic expressions to numerical approximations using “double(s)” or “vpa(s)” is the recommended way instead of using "eval" or evaluating them directly in command window. 
Please refer to the following example "Compare Symbolic and Numeric Results". It explains the same scenario for “besselj” function that is happening with “wrightOmega” function in this case. 
Example for Understanding the Issue:
Please consider following two cases for better understanding and try executing the code in command window. 
Case 1: Using symbolic representation “sym(pi)” in calculations gives the exact answer in symbolic expression.
“case1” is returned as a symbolic object. This is similar to “s” when you use the “solve” command in your code. 
>> case1 = -7/(20*wrightOmega(log(7/20) - sym(pi)*1i)); 
Symbolic object can then be converted to numeric approximation using “double” or “vpa” functions. 
>> double(case1) 
ans = 
       0.2593 
Case 2: Using floating point approximation for “pi” gives numerical approximation of answer which can be prone to round-off errors.
“case2” is returned as a floating point. This is similar to what is happening when you were using “eval(s)”. 
>> case2 =  -7/(20*wrightOmega(log(7/20) - pi*1i)) 
case2 =  
         0.0168 - 0.0399i