lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 548812c: Reduce precision for system testing


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 548812c: Reduce precision for system testing
Date: Mon, 20 May 2019 21:00:38 -0400 (EDT)

branch: master
commit 548812c41b4e22a89f1cd107905081167a4e04b3
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Reduce precision for system testing
    
    System-testing results are observed to differ between two versions of
    i686-gcc-7.3.0: the MinGW-w64 project's native compiler:
      i686-7.3.0-release-win32-sjlj-rt_v5-rev0.7z
    and this debian package:
      i686-w64-mingw32-gcc (GCC) 7.3-win32 20180506
    More differences are observed between gcc-7.3.0 and gcc-8.3.0, but their
    complexion is the same.
    
    The discrepancies are seen in '.tsv' and '.xml' files only, and are
    often one ulp, but sometimes greater. At least in this particular case:
    
      19627.393028129   = 40d32ad9275f741f  32-bit gcc-7.3 (debian)
      19627.39302812901 = 40d32ad9275f7420  32-bit gcc-8.3 (debian)
    
    the values actually differ, so the divergence is not simply attributable
    to any change in low-level formatting routines.
    
    Reducing the number of decimal places by one leaves only this discrepant
    value:
    
      0.092577054119109 gcc-7
      0.092577054119108 gcc-8
         12345678901234 <-- fourteenth digit
    
    Therefore, reduced output precision by two digits iff system testing.
    
    These '.tsv' and '.xml' files actually fulfill two distinct purposes:
    
    - For use in production and research, they are loaded into spreadsheets,
    which benefit from all available precision. Generally they represent
    unrounded intermediate values used in the calculation of the rounded
    final values printed on illustrations. For this use case, the present
    revision has no effect.
    
    - For system testing, they serve mainly to exercise the code that
    produces them, guarding against catastrophic failures therein. Values
    actually printed on illustrations are written to '.test' files, where
    even a small numerical difference may indicate a real problem, but if
    all '.test' files are identical to a saved touchstone, the system test
    succeeds. It is enormously convenient to compare only the md5sums of
    all 1500 or so generated system-test files; sharing 250 MB of output
    and testing near-equivalence rather than perfect equality would make
    much more work for no real gain.
---
 Makefile.am           | 61 ++++++++++++++++++++++++++++++++++++++++++++++++---
 numeric_io_traits.hpp |  4 +++-
 objects.make          | 48 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f1bdebe..5fe9da8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -571,9 +571,15 @@ test_alert_CXXFLAGS = $(AM_CXXFLAGS)
 test_any_member_SOURCES = \
   $(common_test_objects) \
   any_member_test.cpp \
+  calendar_date.cpp \
   facets.cpp \
-  miscellany.cpp
+  global_settings.cpp \
+  miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp
 test_any_member_CXXFLAGS = $(AM_CXXFLAGS)
+test_any_member_LDADD = \
+  $(BOOST_LIBS) \
 
 test_assert_lmi_SOURCES = \
   $(common_test_objects) \
@@ -722,14 +728,20 @@ test_global_settings_LDADD = \
 
 test_gpt_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
   commutation_functions.cpp \
   cso_table.cpp \
+  global_settings.cpp \
   gpt_commutation_functions.cpp \
   gpt_test.cpp \
   ihs_irc7702.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   timer.cpp
 test_gpt_CXXFLAGS = $(AM_CXXFLAGS)
+test_gpt_LDADD = \
+  $(BOOST_LIBS) \
 
 test_handle_exceptions_SOURCES = \
   $(common_test_objects) \
@@ -743,11 +755,17 @@ test_ieee754_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_input_seq_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
+  global_settings.cpp \
   input_sequence.cpp \
   input_sequence_parser.cpp \
   input_sequence_test.cpp \
-  miscellany.cpp
+  miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp
 test_input_seq_CXXFLAGS = $(AM_CXXFLAGS)
+test_input_seq_LDADD = \
+  $(BOOST_LIBS) \
 
 test_input_SOURCES = \
   $(common_test_objects) \
@@ -803,10 +821,14 @@ test_interpolate_string_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_irc7702a_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
+  global_settings.cpp \
   ihs_irc7702a.cpp \
   irc7702a_test.cpp \
   mec_state.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   stratified_algorithms.cpp \
   xml_lmi.cpp
 test_irc7702a_CXXFLAGS = $(AM_CXXFLAGS) $(XMLWRAPP_CFLAGS)
@@ -902,9 +924,13 @@ test_mortality_rates_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_name_value_pairs_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
+  global_settings.cpp \
   miscellany.cpp \
   name_value_pairs.cpp \
-  name_value_pairs_test.cpp
+  name_value_pairs_test.cpp \
+  null_stream.cpp \
+  path_utility.cpp
 test_name_value_pairs_CXXFLAGS = $(AM_CXXFLAGS)
 test_name_value_pairs_LDADD = \
   $(BOOST_LIBS)
@@ -916,10 +942,16 @@ test_ncnnnpnn_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_numeric_io_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
+  global_settings.cpp \
   miscellany.cpp \
+  null_stream.cpp \
   numeric_io_test.cpp \
+  path_utility.cpp \
   timer.cpp
 test_numeric_io_CXXFLAGS = $(AM_CXXFLAGS)
+test_numeric_io_LDADD = \
+  $(BOOST_LIBS) \
 
 test_path_utility_SOURCES = \
   $(common_test_objects) \
@@ -964,10 +996,16 @@ test_premium_tax_LDADD = \
 
 test_print_matrix_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
   cso_table.cpp \
+  global_settings.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   print_matrix_test.cpp
 test_print_matrix_CXXFLAGS = $(AM_CXXFLAGS)
+test_print_matrix_LDADD = \
+  $(BOOST_LIBS) \
 
 test_product_file_SOURCES = \
   $(common_test_objects) \
@@ -1107,19 +1145,31 @@ test_timer_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_tn_range_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
   datum_base.cpp \
   facets.cpp \
+  global_settings.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   tn_range_test.cpp \
   tn_range_test_aux.cpp
 test_tn_range_CXXFLAGS = $(AM_CXXFLAGS)
+test_tn_range_LDADD = \
+  $(BOOST_LIBS) \
 
 test_value_cast_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
   facets.cpp \
+  global_settings.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   value_cast_test.cpp
 test_value_cast_CXXFLAGS = $(AM_CXXFLAGS)
+test_value_cast_LDADD = \
+  $(BOOST_LIBS) \
 
 test_vector_SOURCES = \
   $(common_test_objects) \
@@ -1134,12 +1184,17 @@ test_wx_new_CXXFLAGS = $(AM_CXXFLAGS)
 
 test_xml_serialize_SOURCES = \
   $(common_test_objects) \
+  calendar_date.cpp \
+  global_settings.cpp \
   miscellany.cpp \
+  null_stream.cpp \
+  path_utility.cpp \
   timer.cpp \
   xml_lmi.cpp \
   xml_serialize_test.cpp
 test_xml_serialize_CXXFLAGS = $(AM_CXXFLAGS) $(XMLWRAPP_CFLAGS)
 test_xml_serialize_LDADD = \
+  $(BOOST_LIBS) \
   $(XMLWRAPP_LIBS)
 
 test_zero_SOURCES = \
diff --git a/numeric_io_traits.hpp b/numeric_io_traits.hpp
index ce94b0e..784d182 100644
--- a/numeric_io_traits.hpp
+++ b/numeric_io_traits.hpp
@@ -25,6 +25,7 @@
 #include "config.hpp"
 
 #include "bourn_cast.hpp"
+#include "global_settings.hpp"
 #include "ieee754.hpp"                  // is_infinite<>()
 #include "miscellany.hpp"               // rtrim()
 
@@ -75,7 +76,8 @@ inline int floating_point_decimals(T t)
         return 0;
         }
     long double z = std::numeric_limits<T>::epsilon() * std::fabs(t);
-    return std::max(0, static_cast<int>(-std::log10(z)));
+    int const fuzz = global_settings::instance().regression_testing() ? -2 : 0;
+    return std::max(0, fuzz + static_cast<int>(-std::log10(z)));
 }
 
 /// Simplify a formatted floating-point number.
diff --git a/objects.make b/objects.make
index 19574bd..f332a07 100644
--- a/objects.make
+++ b/objects.make
@@ -511,10 +511,15 @@ alert_test$(EXEEXT): \
   alert_test.o \
 
 any_member_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
   any_member_test.o \
+  calendar_date.o \
   facets.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
 
 assert_lmi_test$(EXEEXT): \
   $(common_test_objects) \
@@ -640,13 +645,18 @@ global_settings_test$(EXEEXT): \
   path_utility.o \
 
 gpt_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
   commutation_functions.o \
   cso_table.o \
+  global_settings.o \
   gpt_commutation_functions.o \
   gpt_test.o \
   ihs_irc7702.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   timer.o \
 
 handle_exceptions_test$(EXEEXT): \
@@ -658,11 +668,16 @@ ieee754_test$(EXEEXT): \
   ieee754_test.o \
 
 input_sequence_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
+  global_settings.o \
   input_sequence.o \
   input_sequence_parser.o \
   input_sequence_test.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
 
 input_test$(EXEEXT): \
   $(boost_filesystem_objects) \
@@ -717,10 +732,14 @@ irc7702a_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
   $(xmlwrapp_objects) \
+  calendar_date.o \
+  global_settings.o \
   ihs_irc7702a.o \
   irc7702a_test.o \
   mec_state.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   stratified_algorithms.o \
   xml_lmi.o \
 
@@ -802,18 +821,27 @@ mortality_rates_test$(EXEEXT): \
 name_value_pairs_test$(EXEEXT): \
   $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
+  global_settings.o \
   miscellany.o \
   name_value_pairs.o \
   name_value_pairs_test.o \
+  null_stream.o \
+  path_utility.o \
 
 ncnnnpnn_test$(EXEEXT): \
   $(common_test_objects) \
   ncnnnpnn_test.o \
 
 numeric_io_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
   numeric_io_test.o \
+  path_utility.o \
   timer.o \
 
 path_utility_test$(EXEEXT): \
@@ -854,9 +882,14 @@ premium_tax_test$(EXEEXT): \
   xml_lmi.o \
 
 print_matrix_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
   cso_table.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   print_matrix_test.o \
 
 product_file_test$(EXEEXT): \
@@ -975,17 +1008,27 @@ timer_test$(EXEEXT): \
   timer_test.o \
 
 tn_range_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
   datum_base.o \
   facets.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   tn_range_test.o \
   tn_range_test_aux.o \
 
 value_cast_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
+  calendar_date.o \
   facets.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   value_cast_test.o \
 
 vector_test$(EXEEXT): \
@@ -998,9 +1041,14 @@ wx_new_test$(EXEEXT): \
   wx_new_test.o \
 
 xml_serialize_test$(EXEEXT): \
+  $(boost_filesystem_objects) \
   $(common_test_objects) \
   $(xmlwrapp_objects) \
+  calendar_date.o \
+  global_settings.o \
   miscellany.o \
+  null_stream.o \
+  path_utility.o \
   timer.o \
   xml_lmi.o \
   xml_serialize_test.o \



reply via email to

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