[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 62fecd5 1/4: Demonstrate and document a mater
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 62fecd5 1/4: Demonstrate and document a materially_equal() technicality |
Date: |
Thu, 22 Feb 2018 20:17:40 -0500 (EST) |
branch: master
commit 62fecd59e57d74cde4e0eda54e33712f981eacdb
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Demonstrate and document a materially_equal() technicality
---
materially_equal.hpp | 8 +++++---
materially_equal_test.cpp | 4 +++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/materially_equal.hpp b/materially_equal.hpp
index aebbf3c..646e447 100644
--- a/materially_equal.hpp
+++ b/materially_equal.hpp
@@ -32,9 +32,11 @@
/// they're actually equal; or
/// the absolute value of their difference is less than a specified
/// tolerance times the lesser in absolute value.
-/// This is the "essentially equal to" operator defined in Knuth,
-/// TAOCP, volume 2, section 4.2.2, equation (34), on page 219 of the
-/// second edition.
+/// This is akin to the "essentially equal to" relation described in
+/// Knuth, TAOCP, volume 2, section 4.2.2, equation (34), on page 219
+/// of the second edition...but see:
+/// https://lists.nongnu.org/archive/html/lmi/2018-02/msg00099.html
+/// et seqq.
///
/// The default tolerance is 1.0E-13, a popular default value for the
/// APL language's 'comparison tolerance', and the only such value
diff --git a/materially_equal_test.cpp b/materially_equal_test.cpp
index 5955d06..230b026 100644
--- a/materially_equal_test.cpp
+++ b/materially_equal_test.cpp
@@ -153,6 +153,9 @@ int test_main(int, char*[])
BOOST_TEST_EQUAL( 1.1, material_difference(1.1, 0.0));
BOOST_TEST_EQUAL(-1.1, material_difference(0.0, 1.1));
+ // https://lists.nongnu.org/archive/html/lmi/2018-02/msg00099.html
+ BOOST_TEST_UNEQUAL(0.0, material_difference(0.0, 1e-100));
+
BOOST_TEST_EQUAL
(0.0
,material_difference(1234567890.123456789, 1234567890.123456789)
@@ -167,7 +170,6 @@ int test_main(int, char*[])
(0.0
,material_difference(1234567890.123456789, 1234567890.123)
);
-
return 0;
}