[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1744d568 07/10: Regularize every mention of n
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1744d568 07/10: Regularize every mention of nextafter() |
Date: |
Mon, 20 Jun 2022 19:16:23 -0400 (EDT) |
branch: master
commit 1744d568a9e2fb9bc50ebb87a7fa13283bee1a34
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Regularize every mention of nextafter()
Include <cmath> (explaining why) wherever this function is used; and
always write 'std::' before (to ensure that the overloaded C++ function
is used: C99 has a type-generic version, but that's available only if
<tgmath.h> in included).
---
bourn_cast_test.cpp | 2 +-
round_test.cpp | 14 +++++++-------
round_to_test.cpp | 6 +++---
tn_range.tpp | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 8cc19ef6..5f35b0e1 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -55,7 +55,7 @@ inline To bourn_cast(From from)
#include "timer.hpp"
#include <climits> // INT_MIN, LLONG_MIN, SCHAR_MIN
-#include <cmath> // isnormal()
+#include <cmath> // isnormal(), nextafterf()
/// Test trivial casts between identical types.
diff --git a/round_test.cpp b/round_test.cpp
index 7395b8c4..45617015 100644
--- a/round_test.cpp
+++ b/round_test.cpp
@@ -41,7 +41,7 @@
#include <algorithm> // max()
#include <cfloat> // DECIMAL_DIG
-#include <cmath> // round()
+#include <cmath> // nextafter(), round()
#include <ios>
#include <iostream>
#include <limits>
@@ -353,20 +353,20 @@ void test_rounding()
// | 4503599627370498.
//
// The number above that's very close to one-half is in fact
- // nextafter(0.5, 0.0)
+ // std::nextafter(0.5, 0.0)
// both of which are ffffffffffffdf3f / 3fdfffffffffffff internally.
test_various_float_types(4503599627370497.0L, 4503599627370497.0L);
// This test:
-// test_various_float_types(nextafter(0.5L, 0.0L), 0.0L);
+// test_various_float_types(std::nextafter(0.5L, 0.0L), 0.0L);
// mustn't be run as such because, e.g., the value
- // static_cast<float>(nextafter(0.5L, 0.0L))
+ // static_cast<float>(std::nextafter(0.5L, 0.0L))
// need not be distinct from 0.0F.
- LMI_TEST((test_one_case(nextafterf(0.5F, 0.0F), 0.0F)));
- LMI_TEST((test_one_case(nextafter (0.5 , 0.0 ), 0.0 )));
- LMI_TEST((test_one_case(nextafterl(0.5L, 0.0L), 0.0L)));
+ LMI_TEST((test_one_case(std::nextafterf(0.5F, 0.0F), 0.0F)));
+ LMI_TEST((test_one_case(std::nextafter (0.5 , 0.0 ), 0.0 )));
+ LMI_TEST((test_one_case(std::nextafterl(0.5L, 0.0L), 0.0L)));
}
int test_all_modes(bool synchronize)
diff --git a/round_to_test.cpp b/round_to_test.cpp
index 6302f2b2..01be605b 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -33,7 +33,7 @@
#include <algorithm> // max()
#include <cfloat> // DECIMAL_DIG
#include <climits> // INT_MIN
-#include <cmath> // fabs()
+#include <cmath> // fabs(), nextafter()
#include <ios>
#include <iostream>
#include <limits>
@@ -547,8 +547,8 @@ void round_to_test::test_scaling()
{
scoped_ios_format meaningless_name(std::cout);
double const volatile d0 = 2.71828'18284'59045'23536;
- double const lo = nextafter(d0, -INFINITY);
- double const hi = nextafter(d0, INFINITY);
+ double const lo = std::nextafter(d0, -INFINITY);
+ double const hi = std::nextafter(d0, INFINITY);
double const volatile d1 = (d0 * 1.0e8) / 1.0e8;
double const volatile dreciprocal = 1.0 / 1.0e8;
diff --git a/tn_range.tpp b/tn_range.tpp
index 4e215826..578a7d79 100644
--- a/tn_range.tpp
+++ b/tn_range.tpp
@@ -220,7 +220,7 @@ namespace
return is_exact_integer_tester<T>()(t);
}
- /// Like C99 nextafter(), but prevents range error, and returns
+ /// Like std::nextafter(), but prevents range error, and returns
/// exact integral values unchanged.
template<typename T>
- [lmi-commits] [lmi] master updated (876d4b5b -> 50009ece), Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master e986f0c9 02/10: Specify types more explicitly in unit test, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master a6f2830d 01/10: Explain the necessity of a certain cast, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 3c9845b4 06/10: State the purpose of a particular unit test, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 8f5b6960 04/10: Demonstrate object sizes in unit test, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 1744d568 07/10: Regularize every mention of nextafter(),
Greg Chicares <=
- [lmi-commits] [lmi] master e711587c 08/10: Expunge a workaround for an obsolete compiler, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 168e9a70 03/10: Specify a constant more clearly, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 7258e4ae 05/10: Establish and test explicit postconditions, Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master 50009ece 10/10: x⋅(1+ε) ≢ nextafter(x) [264], Greg Chicares, 2022/06/20
- [lmi-commits] [lmi] master e7278f90 09/10: Add some functions to complement std::nextafter(), Greg Chicares, 2022/06/20