[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]);
}
//============================================================================
- [lmi-commits] [lmi] valyuta/002 9dc1602 10/21: Remove double relops, (continued)
- [lmi-commits] [lmi] valyuta/002 9dc1602 10/21: Remove double relops, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 b803441 12/21: Improve documentation, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 06046b6 05/21: Revert "Make it float", Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 215244a 13/21: Avoid implicit mixed-mode calculations more avidly, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 63419d4 14/21: Improve documentation, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 d8e2470 15/21: Refactor for clarity, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 b07371e 17/21: Avoid implicit conversions yet more avidly, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 331e748 18/21: Unbreak a unit test, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 02d03f2 08/21: Discard more commented-out code, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 3266cfe 11/21: Establish a separate test/ directory for this branch, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 0e9baa5 16/21: Use currency where currency is wanted,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/002 97e9057 21/21: Fix a unit test, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 8785c00 19/21: Implement negation operator, Greg Chicares, 2020/09/18
- [lmi-commits] [lmi] valyuta/002 97eb31d 20/21: Use negation operator, Greg Chicares, 2020/09/18