lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5809] Trap negative premium


From: Greg Chicares
Subject: [lmi-commits] [5809] Trap negative premium
Date: Tue, 29 Oct 2013 16:54:42 +0000

Revision: 5809
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5809
Author:   chicares
Date:     2013-10-29 16:54:39 +0000 (Tue, 29 Oct 2013)
Log Message:
-----------
Trap negative premium

Modified Paths:
--------------
    lmi/trunk/gpt_commutation_functions.cpp

Modified: lmi/trunk/gpt_commutation_functions.cpp
===================================================================
--- lmi/trunk/gpt_commutation_functions.cpp     2013-10-27 22:00:19 UTC (rev 
5808)
+++ lmi/trunk/gpt_commutation_functions.cpp     2013-10-29 16:54:39 UTC (rev 
5809)
@@ -240,6 +240,10 @@
 ///
 /// Asserted preconditions: Duration is within its natural bounds, and
 /// other members of 'args' are nonnegative.
+///
+/// Asserted postcondition: Returned GLP or GSP is nonnegative; thus,
+/// while adjusted premium 'A+B-C' may be negative, {A,B,C} are all
+/// individually nonnegative.
 
 double gpt_cf_triad::calculate_premium
     (oenum_glp_or_gsp        glp_or_gsp
@@ -267,6 +271,8 @@
         : throw std::runtime_error("Cannot determine GPT assumptions.")
         ;
     LMI_ASSERT(0 != pcf); // Redundant: demonstrably cannot fail.
-    return pcf->calculate_premium(glp_or_gsp, args);
+    double const z = pcf->calculate_premium(glp_or_gsp, args);
+    LMI_ASSERT(0.0 <= z);
+    return z;
 }
 




reply via email to

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