lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 0e9baa5 16/21: Use currency where curren


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 0e9baa5 16/21: Use currency where currency is wanted
Date: Fri, 18 Sep 2020 21:53:49 -0400 (EDT)

branch: valyuta/002
commit 0e9baa58e9026ddc76af683d80ac5c88842f6f73
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use currency where currency is wanted
    
    This function is never called without transforming its result to
    currency anyway. Explicit rounding in an explicit manner is better
    than implicit rounding in some default manner.
---
 account_value.hpp |  2 +-
 accountvalue.cpp  |  4 ++--
 ihs_acctval.cpp   | 11 ++++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/account_value.hpp b/account_value.hpp
index 0753a69..0a409b1 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -103,7 +103,7 @@ class LMI_SO AccountValue final
 
     double InforceLivesBoy         () const;
     double InforceLivesEoy         () const;
-    double GetSepAcctAssetsInforce () const;
+    currency GetSepAcctAssetsInforce () const;
 
     void process_payment          (currency);
     void IncrementAVProportionally(currency);
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 5723536..ca23075 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -1066,8 +1066,8 @@ double AccountValue::GetCurtateNetCoiChargeInforce() const
     {return 0.0;}
 double AccountValue::GetProjectedCoiChargeInforce() const
     {return 0.0;}
-double AccountValue::GetSepAcctAssetsInforce() const
-    {return 0.0;}
+currency AccountValue::GetSepAcctAssetsInforce() const
+    {return currency();}
 currency AccountValue::IncrementBOM(int, int, double)
     {return currency();}
 void   AccountValue::IncrementEOM(int, int, currency, currency)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 2534c73..9e6f0b2 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -1458,17 +1458,18 @@ void AccountValue::SetAnnualInvariants()
 
 /// Separate-account assets, after deductions, times survivorship.
 ///
-/// Returns a double: assets are ordinarily currency, but these are
-/// multiplied by a survivorship factor.
+/// Returns a currency value because assets are ordinarily thought of
+/// as currency, and because this function is used only where currency
+/// is wanted--even though it's multiplied by a survivorship factor.
 
-double AccountValue::GetSepAcctAssetsInforce() const
+currency AccountValue::GetSepAcctAssetsInforce() const
 {
     if(ItLapsed || BasicValues::GetLength() <= Year)
         {
-        return 0.0;
+        return currency();
         }
 
-    return SepAcctValueAfterDeduction * partial_mortality_lx()[Year];
+    return round_minutiae().c(SepAcctValueAfterDeduction * 
partial_mortality_lx()[Year]);
 }
 
 //============================================================================



reply via email to

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