lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master a67210ec 10/13: Better explain the purpose of


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a67210ec 10/13: Better explain the purpose of each block of unit tests
Date: Mon, 9 May 2022 20:13:18 -0400 (EDT)

branch: master
commit a67210ec8dcf7075910477640c181b12b0ef3082
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Better explain the purpose of each block of unit tests
---
 ul_utilities_test.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ul_utilities_test.cpp b/ul_utilities_test.cpp
index 683aa21e..a0820094 100644
--- a/ul_utilities_test.cpp
+++ b/ul_utilities_test.cpp
@@ -34,6 +34,9 @@
 
 void test_max_modal_premium()
 {
+    // Demonstrate the reasonableness of using materially_equal(),
+    // with its default tolerance, in rate_times_currency().
+
     auto test_excess_precision = [](double rate)
         {
         using int64 = std::int64_t;
@@ -68,7 +71,7 @@ void test_max_modal_premium()
     round_to<double> const round_not (2, r_not_at_all);
     round_to<double> const round_up  (2, r_upward);
 
-    // Motivating example from an actual regression test:
+    // Elucidate an example from an actual regression test:
     //   0.00000250 specified-amount load
     //      $250000 specified amount
     // In binary64 arithmetic, this is
@@ -93,6 +96,10 @@ void test_max_modal_premium()
     // cent in a monthly deduction grew to $79.19 at compound interest over 75
     // years. Reasonableness check: the implicit annual percentage rate is
 
+    // Test a rate and a specamt that use maximal precision,
+    // because so many real-world examples are along the lines of
+    // 0.01 * $100,000 .
+
     double   const rate    {0.0123456700000001};
     currency const specamt {9'876'543'21_cents};
 



reply via email to

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