lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ec0a308 06/22: Refactor


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ec0a308 06/22: Refactor
Date: Sun, 6 Jun 2021 21:38:00 -0400 (EDT)

branch: master
commit ec0a3089905f17b0214c0afd80034e83a7cc09da
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Refactor
    
    Conditionally warn about the (const) return value just before return.
---
 ihs_avsolve.cpp | 21 ++++++++++-----------
 solve.cpp       | 10 +++++-----
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index 95ce206..05332b4 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -457,17 +457,6 @@ currency AccountValue::Solve
         ,solve_helper
         ,os_trace
         );
-
-    if(root_not_bracketed == solution.second)
-        {
-        LMI_ASSERT(0.0 == solution.first);
-        // Don't want this firing continually in census runs.
-        if(!SolvingForGuarPremium)
-            {
-            warning() << "Solution not found: using zero instead." << 
LMI_FLUSH;
-            // TODO ?? What can we do when no solution exists for guar prem?
-            }
-        }
     currency const solution_cents = round_minutiae().c(solution.first);
 
     Solving = false;
@@ -479,5 +468,15 @@ currency AccountValue::Solve
     // now, and actual values are freshly generated downstream.
     (this->*solve_set_fn)(solution_cents);
 
+    if(root_not_bracketed == solution.second)
+        {
+        LMI_ASSERT(0.0 == solution.first);
+        // Don't want this firing continually in census runs.
+        if(!SolvingForGuarPremium)
+            {
+            warning() << "Solution not found: using zero instead." << 
LMI_FLUSH;
+            // TODO ?? What can we do when no solution exists for guar prem?
+            }
+        }
     return solution_cents;
 }
diff --git a/solve.cpp b/solve.cpp
index e0673c9..7dfb3c9 100644
--- a/solve.cpp
+++ b/solve.cpp
@@ -330,11 +330,6 @@ currency AccountValue::Solve()
         ,SolveFn
         ,status()
         );
-    if(root_not_bracketed == solution.second)
-        {
-        LMI_ASSERT(0.0 == solution.first);
-        warning() << "solution not found. Using zero instead." << LMI_FLUSH;
-        }
     currency const solution_cents = round_to_cents.c(solution.first);
 
     Solving = false;
@@ -352,5 +347,10 @@ currency AccountValue::Solve()
     // now, and actual values are freshly generated downstream.
     SolveFn(dblize(solution_cents));
 
+    if(root_not_bracketed == solution.second)
+        {
+        LMI_ASSERT(0.0 == solution.first);
+        warning() << "solution not found. Using zero instead." << LMI_FLUSH;
+        }
     return solution_cents;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]