Skip to content

Commit

Permalink
Clean up conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzii committed Mar 2, 2024
2 parents c6923da + 35921f6 commit 0e7168d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/ccmath/detail/compare/isnan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace ccm
* @return True if the number is NaN, false otherwise.
*/
template <typename T, std::enable_if_t<!std::is_integral_v<T>, int> = 0>
<<<<<<< HEAD
[[nodiscard]] inline constexpr bool isnan(T x) noexcept
{
#if defined(__GNUC__)
Expand All @@ -31,6 +32,16 @@ namespace ccm
return x != x; // NOLINT
#endif
}
=======
[[nodiscard]] inline constexpr bool isnan(T x) noexcept
{
#if defined(__GNUC__)
return __builtin_isnan(x); // GCC and Clang implement this as constexpr
#else // If we can't use the builtin, fallback to this comparison and hope for the best.
return x != x; // NOLINT
#endif
}
>>>>>>> 35921f6a7694983073fd81e0894043b36543469f

/**
* @brief Check if the given number is NaN.
Expand Down
37 changes: 37 additions & 0 deletions temp_exe/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2024-Present Ian Pike
* Copyright (c) 2024-Present ccmath contributors
*
* This library is provided under the MIT License.
* See LICENSE for more information.
*/

//#include <cmath>
#include <iostream>

#include "ccmath/ccmath.hpp"

#include <cmath>


int main()
{


// EXPECT_EQ(ccm::signbit(-0.0), std::signbit(-0.0));

constexpr double a = -0.0;
constexpr double val = ccm::signbit(a);
static_assert(val == true, "ccm::signbit(-0.0) != true");

// EXPECT_EQ(ccm::trunc(-std::numeric_limits<double>::quiet_NaN()), std::trunc(-std::numeric_limits<double>::quiet_NaN()));

constexpr double b = -std::numeric_limits<double>::quiet_NaN();
constexpr double val2 = ccm::trunc(b);
static_assert(ccm::isnan(val2), "ccm::trunc(-std::numeric_limits<double>::quiet_NaN()) != std::trunc(-std::numeric_limits<double>::quiet_NaN())");


double b2 = ccm::trunc(-std::numeric_limits<double>::quiet_NaN());

return 0;
}

0 comments on commit 0e7168d

Please sign in to comment.