Fixed MSVC error C2124: divide or mod by zero
Alternatively, if quiet_NaN is not available on all platforms a workaround would be:
volatile double zero = 0.0;
double x = 1.0/zero;
The 'volatile' is needed to shut up "warning C4723: potential divide by 0".
Change-Id: If2bbdab8540595aa2e0079e1eb6b6fed6d4a6ef7
diff --git a/internal/ceres/line_search_preprocessor_test.cc b/internal/ceres/line_search_preprocessor_test.cc
index 211ceef..c0b004e 100644
--- a/internal/ceres/line_search_preprocessor_test.cc
+++ b/internal/ceres/line_search_preprocessor_test.cc
@@ -50,7 +50,7 @@
TEST(LineSearchPreprocessor, ProblemWithInvalidParameterBlock) {
ProblemImpl problem;
- double x = 1.0/0.0;
+ double x = std::numeric_limits<double>::quiet_NaN();
problem.AddParameterBlock(&x, 1);
Solver::Options options;
options.minimizer_type = LINE_SEARCH;
diff --git a/internal/ceres/trust_region_preprocessor_test.cc b/internal/ceres/trust_region_preprocessor_test.cc
index 585767c..a6189ad 100644
--- a/internal/ceres/trust_region_preprocessor_test.cc
+++ b/internal/ceres/trust_region_preprocessor_test.cc
@@ -50,7 +50,7 @@
TEST(TrustRegionPreprocessor, ProblemWithInvalidParameterBlock) {
ProblemImpl problem;
- double x = 1.0/0.0;
+ double x = std::numeric_limits<double>::quiet_NaN();
problem.AddParameterBlock(&x, 1);
Solver::Options options;
TrustRegionPreprocessor preprocessor;