Author: Robie Basak <robie.basak@canonical.com>
Description: always use std::isnan
Forwarded: no
Last-Update: 2016-05-04

The C++ standard puts isnan and isinf in the std namespace, so this should be
used in all cases, not just on Cygwin.

--- a/hphp/runtime/ext/std/ext_std_math.h
+++ b/hphp/runtime/ext/std/ext_std_math.h
@@ -39,11 +39,9 @@
 #endif
 #endif
 
-#ifdef __CYGWIN__
 #include <cmath>
 #define isinf std::isinf
 #define isnan std::isnan
-#endif
 
 namespace HPHP {
 ///////////////////////////////////////////////////////////////////////////////
--- a/hphp/runtime/base/zend-printf.cpp
+++ b/hphp/runtime/base/zend-printf.cpp
@@ -42,11 +42,9 @@
 #endif
 #endif
 
-#ifdef __CYGWIN__
 #include <cmath>
 #define isinf std::isinf
 #define isnan std::isnan
-#endif
 
 namespace HPHP {
 
--- a/hphp/runtime/ext_zend_compat/php-src/main/snprintf.cpp
+++ b/hphp/runtime/ext_zend_compat/php-src/main/snprintf.cpp
@@ -989,10 +989,10 @@
               goto fmt_error;
           }
 
-          if (zend_isnan(fp_num)) {
+          if (std::isnan(fp_num)) {
             s = "NAN";
             s_len = 3;
-          } else if (zend_isinf(fp_num)) {
+          } else if (std::isinf(fp_num)) {
             s = "INF";
             s_len = 3;
           } else {
@@ -1030,11 +1030,11 @@
               goto fmt_error;
           }
 
-          if (zend_isnan(fp_num)) {
+          if (std::isnan(fp_num)) {
             s = "NAN";
             s_len = 3;
             break;
-          } else if (zend_isinf(fp_num)) {
+          } else if (std::isinf(fp_num)) {
             if (fp_num > 0) {
               s = "INF";
               s_len = 3;
--- a/hphp/runtime/base/tv-helpers.cpp
+++ b/hphp/runtime/base/tv-helpers.cpp
@@ -672,7 +672,7 @@
   if (RuntimeOption::PHP7_ScalarTypes && tv->m_type == KindOfDouble) {
     if (tv->m_data.dbl < std::numeric_limits<int64_t>::min()) return false;
     if (tv->m_data.dbl > std::numeric_limits<int64_t>::max()) return false;
-    if (isnan(tv->m_data.dbl)) return false;
+    if (std::isnan(tv->m_data.dbl)) return false;
   }
   tvCastToInt64InPlace(tv);
   return true;
