Hi David,
That's weird, I've never had a problem with this constant in CUDA; just checked it now, works on CUDA 7. NAN is a C constant, maybe its availability is platform-specific or something? Which OS are you using? Perhaps I can replace NAN by a more CUDA-specific CUDART_NAN.
As for why it is there - it is mostly a debugging measure; this way if the local memory is accessed incorrectly, there won't be subtle numeric errors, but NaNs all over the place. Also some platforms require the array to be initialized with something (I think it was AMD OpenCL).
Best regards,
Bogdan