nan function requires -lm on some platforms; use of NAN is better, if available.
Merge pull request #123 from fingon/use-NAN-if-available

nan function requires -lm on some platforms - use of NAN is better, if available