mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Small fixes
This MR fixes a bunch of smaller issues, making the following changes: * Template parameters in the documentation are documented with `\tparam` instead of `\param` * Superfluous semicolon warnings fixed * Fixed the type of literals used to initialize float variables
This commit is contained in:
committed by
David Tellenbach
parent
2a6594de29
commit
f7a056bf04
@@ -209,8 +209,8 @@ void test_numtraits()
|
||||
|
||||
void test_arithmetic()
|
||||
{
|
||||
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(2)), 4);
|
||||
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(-2)), 0);
|
||||
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(2)), 4.f);
|
||||
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(-2)), 0.f);
|
||||
VERIFY_IS_APPROX(static_cast<float>(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f);
|
||||
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f);
|
||||
VERIFY_IS_APPROX(static_cast<float>(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// The following includes of STL headers have to be done _before_ the
|
||||
// definition of macros min() and max(). The reason is that many STL
|
||||
// implementations will not work properly as the min and max symbols collide
|
||||
// with the STL functions std:min() and std::max(). The STL headers may check
|
||||
// with the STL functions std::min() and std::max(). The STL headers may check
|
||||
// for the macro definition of min/max and issue a warning or undefine the
|
||||
// macros.
|
||||
//
|
||||
@@ -420,7 +420,8 @@ template<> inline long double test_precision<std::complex<long double> >() { ret
|
||||
inline bool test_isApprox(TYPE a, TYPE b) \
|
||||
{ return internal::isApprox(a, b, test_precision<TYPE>()); } \
|
||||
inline bool test_isCwiseApprox(TYPE a, TYPE b, bool exact) \
|
||||
{ return a == b || ((numext::isnan)(a) && (numext::isnan)(b)) || \
|
||||
{ return numext::equal_strict(a, b) || \
|
||||
((numext::isnan)(a) && (numext::isnan)(b)) || \
|
||||
(!exact && internal::isApprox(a, b, test_precision<TYPE>())); } \
|
||||
inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \
|
||||
{ return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \
|
||||
@@ -664,7 +665,7 @@ bool test_isCwiseApprox(const DenseBase<Derived1>& m1,
|
||||
template<typename T, typename U>
|
||||
bool test_is_equal(const T& actual, const U& expected, bool expect_equal)
|
||||
{
|
||||
if ((actual==expected) == expect_equal)
|
||||
if (numext::equal_strict(actual, expected) == expect_equal)
|
||||
return true;
|
||||
// false:
|
||||
std::cerr
|
||||
|
||||
@@ -62,9 +62,9 @@ EIGEN_DECLARE_TEST(rand)
|
||||
|
||||
for(int i = 0; i < g_repeat*10000; i++) {
|
||||
CALL_SUBTEST(check_in_range<float>(10,11));
|
||||
CALL_SUBTEST(check_in_range<float>(1.24234523,1.24234523));
|
||||
CALL_SUBTEST(check_in_range<float>(1.24234523f,1.24234523f));
|
||||
CALL_SUBTEST(check_in_range<float>(-1,1));
|
||||
CALL_SUBTEST(check_in_range<float>(-1432.2352,-1432.2352));
|
||||
CALL_SUBTEST(check_in_range<float>(-1432.2352f,-1432.2352f));
|
||||
|
||||
CALL_SUBTEST(check_in_range<double>(10,11));
|
||||
CALL_SUBTEST(check_in_range<double>(1.24234523,1.24234523));
|
||||
|
||||
Reference in New Issue
Block a user