MATLAB: Does the BESSELH function return innacurate/ erroneous results

hankleSymbolic Math Toolbox

According to the documentation and the MHELP function the Hankel function of the first kind should be the sum of besselj and j*bessely
Using
mfun('HankelH1',70,10)
mfun('BesselJ',70,10)+ j*mfun('BesselY',70,10)
returns the same result
496.819145473453e-054 - 9.24766635201928e+048i
However the next two statements result in no errors but do not return the same answer.
besselj(70,10) + i*bessely(70,10)
[y ierr]=besselh(70,10)
496.819145473447e-054 - 9.24766635201921e+048i
-4.90647910029498e+033 - 9.24766635201921e+048i

Best Answer

A complex number is one number, not two, even though we store and print the real and imaginary parts separately. The value of this complex-valued Hankel function for arguments in this range is within roundoff error of being purely imaginary.
You can do two separate real computations, or one combined complex computation. As observed, the values of the two real-valued Bessel functions are very different in magnitude. Hence in this case due to the large scaling differences in the real and imaginary parts it is more accurate to evaluate the real and imaginary parts separately.