It doesn't matter if I define double x = a*kw and pass this into the interface, what seems to matter is the value of the index, when n = 8 it doesn't work. It works for 9 and 10 and all integers before 8. I can replace x with a, lambda or pi and it works for n = 8, so it seems to be this combination of numbers or something I'm doing wrong w/r to type casting variables etc.
OK I can reproduce here, and it's very specific to the calculation of Y[8.5](4*Pi), if you change nu at all, or add a tiny increment to the 4PI arg then it all works OK. The problem BTW is exquisite cancellation inside the algorithm, which leads me to suspect there's something "special" about this value. Unfortunately I don't have a fix at present (or understand the root cause yet), more investigation needed.... Thanks for the report, John.