[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0c922cb6 3/8: Rename rel_err() --> relative_e
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0c922cb6 3/8: Rename rel_err() --> relative_error() |
Date: |
Fri, 17 Jun 2022 17:16:28 -0400 (EDT) |
branch: master
commit 0c922cb6ab4f64b75b641ffc59885b21ddf6f063
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename rel_err() --> relative_error()
---
math_functions.hpp | 2 +-
math_functions_test.cpp | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/math_functions.hpp b/math_functions.hpp
index 6fbe59d5..e7713c99 100644
--- a/math_functions.hpp
+++ b/math_functions.hpp
@@ -117,7 +117,7 @@ inline T outward_quotient(T numerator, T denominator)
/// types seems unimportant.
template<typename T>
-/*constexpr*/ T rel_err(T t, T u)
+/*constexpr*/ T relative_error(T t, T u)
{
static_assert(std::is_floating_point_v<T>);
constexpr T inf {std::numeric_limits<T>::infinity()};
diff --git a/math_functions_test.cpp b/math_functions_test.cpp
index a3d26b81..12a91a40 100644
--- a/math_functions_test.cpp
+++ b/math_functions_test.cpp
@@ -482,17 +482,17 @@ void test_relative_error()
constexpr double inf {std::numeric_limits<double>::infinity()};
constexpr double big {std::numeric_limits<double>::max()};
- LMI_TEST_EQUAL(inf, rel_err(0.0, -2.0));
- LMI_TEST_EQUAL(inf, rel_err(0.0, -1.0));
- LMI_TEST_EQUAL(inf, rel_err(0.0, -0.5));
- LMI_TEST_EQUAL(0.0, rel_err(0.0, 0.0));
- LMI_TEST_EQUAL(inf, rel_err(0.0, 0.5));
- LMI_TEST_EQUAL(inf, rel_err(0.0, 1.0));
- LMI_TEST_EQUAL(inf, rel_err(0.0, 2.0));
- LMI_TEST_EQUAL(0.0, rel_err(1.0, 1.0));
- LMI_TEST_EQUAL(2.0, rel_err(1.0, -1.0));
- LMI_TEST_EQUAL(big, rel_err(1.0, big));
- LMI_TEST_EQUAL(inf, rel_err(big, -big));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, -2.0));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, -1.0));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, -0.5));
+ LMI_TEST_EQUAL(0.0, relative_error(0.0, 0.0));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, 0.5));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, 1.0));
+ LMI_TEST_EQUAL(inf, relative_error(0.0, 2.0));
+ LMI_TEST_EQUAL(0.0, relative_error(1.0, 1.0));
+ LMI_TEST_EQUAL(2.0, relative_error(1.0, -1.0));
+ LMI_TEST_EQUAL(big, relative_error(1.0, big));
+ LMI_TEST_EQUAL(inf, relative_error(big, -big));
}
void test_signed_zero()
@@ -710,10 +710,10 @@ void test_expm1_log1p()
double const b2 = std::expm1(std::log1p(irate) / 12);
double const b3 = std::expm1(std::log1p(irate) / 365);
// relative error
- double const e0 = rel_err(a0, b0);
- double const e1 = rel_err(a1, b1);
- double const e2 = rel_err(a2, b2);
- double const e3 = rel_err(a3, b3);
+ double const e0 = relative_error(a0, b0);
+ double const e1 = relative_error(a1, b1);
+ double const e2 = relative_error(a2, b2);
+ double const e3 = relative_error(a3, b3);
// comparison
if(a0 != b0 || a1 != b1 || a2 != b2 || a3 != b3)
{
- [lmi-commits] [lmi] master updated (7d0257a3 -> 876d4b5b), Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master bcd3e721 2/8: Make relative-error function generally available, Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master ac211c61 7/8: Write DECIMAL_DIG where it's obviously intended, Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 876d4b5b 8/8: Remove unhelpful defect markers [265], Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 79298e8c 1/8: Avoid left shift of a negative signed integer in fdlibm, Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 08ec6337 4/8: Genericize relative_error(), Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 4eb11e23 5/8: Use relative_error, Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 8dfc0348 6/8: Remove an obsolete comment, Greg Chicares, 2022/06/17
- [lmi-commits] [lmi] master 0c922cb6 3/8: Rename rel_err() --> relative_error(),
Greg Chicares <=