Various minor bug fixes to the solver logic.

1. CostFunction returning false is handled better.
If only the cost is being evaluated, it is possible to
use the false value as an infinite value signal/outside
a region of validity. This allows a weak form of constraint
handling. Useful for example in handling infinities.

2. Changed the way how the slop around zero when model_cost
is larger than the current cost. Relative instead of absolute
tolerances are used. The same logic is propagated how the
corresponding clamping of the model_cost is done.

3. Fixed a minor indexing bug in nist.cc.

4. Some minor logging fixes to nist.cc to make it more
compatible with the rest of ceres.

Together these changes, take the successful solve count from
41/54 to 46/54 and eliminate all NUMERICAL_FAILURE problems.

Change-Id: If94170ea4731af5b243805c0200963dd31aa94a7
diff --git a/internal/ceres/residual_block.cc b/internal/ceres/residual_block.cc
index 0386789..bdb88b1 100644
--- a/internal/ceres/residual_block.cc
+++ b/internal/ceres/residual_block.cc
@@ -102,8 +102,11 @@
 
   InvalidateEvaluation(*this, cost, residuals, eval_jacobians);
 
-  if (!cost_function_->Evaluate(parameters.get(), residuals, eval_jacobians) ||
-      !IsEvaluationValid(*this,
+  if (!cost_function_->Evaluate(parameters.get(), residuals, eval_jacobians)) {
+    return false;
+  }
+
+  if (!IsEvaluationValid(*this,
                          parameters.get(),
                          cost,
                          residuals,