[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/eraseme_error 95690a5 5/9: Remove a confusing ov
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/eraseme_error 95690a5 5/9: Remove a confusing overload |
Date: |
Thu, 8 Jul 2021 16:26:47 -0400 (EDT) |
branch: odd/eraseme_error
commit 95690a558bbce467dcf68d91ffc64d456f9847cf
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Remove a confusing overload
This will be elucidated on 'master'.
---
financial.hpp | 2 ++
financial_test.cpp | 12 +++---------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/financial.hpp b/financial.hpp
index ada1e9a..a69fddb 100644
--- a/financial.hpp
+++ b/financial.hpp
@@ -160,6 +160,7 @@ long double irr
return irr_helper<InputIterator>(first, last, x, decimals)();
}
+#if 0
template<typename InputIterator>
long double irr
(InputIterator first
@@ -169,6 +170,7 @@ long double irr
{
return irr_helper<InputIterator>(first, last - 1, -*(last - 1),
decimals)();
}
+#endif // 0
template
<typename InputIterator0
diff --git a/financial_test.cpp b/financial_test.cpp
index e9758e9..5143b38 100644
--- a/financial_test.cpp
+++ b/financial_test.cpp
@@ -59,7 +59,7 @@ int test_main(int, char*[])
// Test with arrays.
double cash_flows[4] = {pmts[0], pmts[1], pmts[2], -bfts[2]};
- LMI_TEST_EQUAL(2.0, irr(cash_flows, 4 + cash_flows, 5));
+ LMI_TEST_EQUAL(2.0, irr(pmts, 3 + pmts, bfts[2], 5));
LMI_TEST_EQUAL( 882.8125, fv(cash_flows + 0, cash_flows + 3, 0.25));
LMI_TEST_EQUAL( 2200.0 , fv(cash_flows + 0, cash_flows + 3, 1.0 ));
@@ -72,14 +72,8 @@ int test_main(int, char*[])
LMI_TEST_EQUAL(-6400.0 , fv(cash_flows + 0, cash_flows + 4, 1.0 ));
// Test with vectors.
- std::vector<double> v(cash_flows, 4 + cash_flows);
- // The next test is begging to fail. It was designed so that 200%
- // is a root; but appending a zero at the end of the stream makes
- // -100% a root, and arguably a preferable one. Reason: any stream
- // of payments accumulates to a future value of zero at a rate of
- // -100%.
- LMI_TEST_EQUAL(-1.0, irr(v.begin(), v.end(), 0.0, 5));
- LMI_TEST_EQUAL(2.0, irr(v.begin(), v.end(), 5));
+ std::vector<double> v(pmts, 3 + pmts);
+ LMI_TEST_EQUAL(2.0, irr(v.begin(), v.end(), bfts[2], 5));
std::vector<double> p; // Payments.
std::vector<double> b; // Benefits.
- [lmi-commits] [lmi] odd/eraseme_error updated (69d06e9 -> 58863bf), Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 35f8824 1/9: Trace IRR calculations, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 7b5c07f 6/9: Move and rename a function, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 6c0d108 4/9: Add a couple obvious tests, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 95690a5 5/9: Remove a confusing overload,
Greg Chicares <=
- [lmi-commits] [lmi] odd/eraseme_error cf5cced 7/9: Re-break; fail better, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 273f15b 8/9: Restore un-breakage, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 58863bf 9/9: Improve speed measurements, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error 05e74a5 3/9: Clean up, Greg Chicares, 2021/07/08
- [lmi-commits] [lmi] odd/eraseme_error ee0dc1c 2/9: Fix the problem in a slapdash manner, Greg Chicares, 2021/07/08