Fix building errors of isnan with different GCC versions
Current code works fine with gcc < 5.0, however when building against GCC 5.4.1(default on Ubuntu 16.04) would lead to isnan is not defined within the scope. A gcc version check macro is added to fix this problem.
Relates to #98 (closed) .