Use C99 macros on Android for fpclassify.h Change-Id: I7118f05b436afadbff5369ce40d5b9ab95e8a437
diff --git a/include/ceres/fpclassify.h b/include/ceres/fpclassify.h index 550d4d4..a5e8f99 100644 --- a/include/ceres/fpclassify.h +++ b/include/ceres/fpclassify.h
@@ -52,6 +52,14 @@ return classification == _FPCLASS_NN || classification == _FPCLASS_PN; } +#elif defined(ANDROID) +// On Android, the C++ fpclassify functions are not available. Strictly +// speaking, the std functions are are not standard until C++11. Instead use +// the C99 macros on Android. +inline bool IsFinite (double x) { return isfinite(x); } +inline bool IsInfinite(double x) { return isinf(x); } +inline bool IsNaN (double x) { return isnan(x); } +inline bool IsNormal (double x) { return isnormal(x); } #else // TODO(keir): Test the "else" with more platforms. inline bool IsFinite (double x) { return std::isfinite(x); }