[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/004 0c93fc2 02/11: Fix a problem somewhat my
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/004 0c93fc2 02/11: Fix a problem somewhat mystically |
Date: |
Sun, 20 Dec 2020 17:40:08 -0500 (EST) |
branch: valyuta/004
commit 0c93fc202fa9dd7c32c4aff9f2a78cbbff62d4a3
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Fix a problem somewhat mystically
An assertion had failed, even though that seemed impossible. Displaying
the values of the quantities that it asserted to be equal prevented the
assertion from failing; but they were displayed only when the assertion
would have failed, yet that failure was prevented by displaying the
values. Attempts to reproduce the problem in a simple standalone test
case were unsuccessful.
The input class stores the solve target value from the input class as a
double. Formerly, a target such as $1.23 was converted to 123¢, though
of course it was really something like 1.23000001 and was converted to
123.000001 when it should have been rounded. Now, it's rounded to 123¢,
with an underlying (double) value of exactly 123.
Correcting that actual defect caused the mysterious assertion failure
to vanish. This being a casual branch, we grit our teeth and declare
victory. The assertion is peculiar anyway: it occurs seven times in this
TU, and clearly should never fail, yet it's been around for decades, and
it was obviously written for some reason.
---
ihs_acctval.cpp | 2 +-
ihs_avmly.cpp | 10 ----------
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index aba0680..41c9e01 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -290,7 +290,7 @@ void AccountValue::RunAllApplicableBases()
,yare_input_.SolveBeginYear
,yare_input_.SolveEndYear
,yare_input_.SolveTarget
- ,currency(yare_input_.SolveTargetValue)
+ ,round_minutiae().c(yare_input_.SolveTargetValue)
,yare_input_.SolveTargetYear
,yare_input_.SolveExpenseGeneralAccountBasis
,yare_input_.SolveSeparateAccountBasis
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index d831b96..789c737 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -1285,16 +1285,6 @@ void AccountValue::TxAscertainDesiredPayment()
}
// if(!(materially_equal(GrossPmts[Month], EeGrossPmts[Month] +
ErGrossPmts[Month])))
- if(GrossPmts[Month] != EeGrossPmts[Month] + ErGrossPmts[Month])
- warning()
- << GrossPmts[Month] << " GrossPmts[Month]\n"
- << EeGrossPmts[Month] + ErGrossPmts[Month] << " EeGrossPmts[Month]
+ ErGrossPmts[Month]\n"
- << EeGrossPmts[Month] << " EeGrossPmts[Month]\n"
- << ErGrossPmts[Month] << " ErGrossPmts[Month]\n"
- << Year << " Year\n"
- << Month << " Month\n"
- << LMI_FLUSH
- ;
// LMI_ASSERT(materially_equal(GrossPmts[Month], EeGrossPmts[Month] +
ErGrossPmts[Month]));
LMI_ASSERT(GrossPmts[Month] == EeGrossPmts[Month] + ErGrossPmts[Month]);
}
- [lmi-commits] [lmi] valyuta/004 be42a58 03/11: Assert rather than assign, (continued)
- [lmi-commits] [lmi] valyuta/004 be42a58 03/11: Assert rather than assign, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 4a58266 09/11: Suppress the costly assertion that was recently added, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 2913536 06/11: Fix a unit test, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 c5f666f 08/11: Improve rounding to cents for solves, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 34326d6 04/11: Eliminate a return code that was always zero, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 abb1363 05/11: Refactor a unit test, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 7eacf2b 07/11: Prefer explicit to implicit currency rounding in unit test, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 58962eb 01/11: Refactor, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 9a03ce9 10/11: Add a handy git command, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 b73e751 11/11: Record timings as of 20201215T2247Z SHA1 3742c540, Greg Chicares, 2020/12/20
- [lmi-commits] [lmi] valyuta/004 0c93fc2 02/11: Fix a problem somewhat mystically,
Greg Chicares <=