Skip to content

Commit

Permalink
Revert "Bring hot patch version 0.1.2 into main (#18)"
Browse files Browse the repository at this point in the history
This reverts commit b9dae17.
  • Loading branch information
Rinzii authored Mar 14, 2024
1 parent b9dae17 commit 25f3f93
Show file tree
Hide file tree
Showing 25 changed files with 331 additions and 898 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.18)

set(CCMATH_BUILD_VERSION 0.1.2)
set(CCMATH_BUILD_VERSION 0.1.1)
set(INTERNAL_PROJ_DEFAULT_NAME ccmath)

project(${INTERNAL_PROJ_DEFAULT_NAME} VERSION ${CCMATH_BUILD_VERSION})
Expand Down
202 changes: 101 additions & 101 deletions README.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion benchmark/ccmath_benchmark_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ static void BM_ccm_log(bm::State& state) {
for (auto _ : state) {
bm::DoNotOptimize(ccm::log(state.range(0)));
}
state.SetComplexityN(state.range(0));
}
BENCHMARK(BM_ccm_log)->Arg(16)->Arg(256)->Arg(4096)->Arg(65536)->Complexity();

Expand Down
36 changes: 8 additions & 28 deletions ccmath_headers.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
##########################################
# Internal headers
##########################################

set(ccmath_internal_helpers_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/internal/helpers/bits.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/internal/helpers/endian.hpp
Expand Down Expand Up @@ -43,18 +39,7 @@ set(ccmath_internal_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/internal/version.hpp
)


##########################################
# Detail headers
##########################################

set(ccmath_detail_basic_impl_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/basic/impl/remquo_float_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/basic/impl/remquo_double_impl.hpp
)

set(ccmath_detail_basic_headers
${ccmath_detail_basic_impl_headers}
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/basic/abs.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/basic/fdim.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/basic/fma.hpp
Expand All @@ -80,17 +65,17 @@ set(ccmath_detail_compare_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/compare/signbit.hpp
)

set(ccmath_detail_exponential_impl_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log_float_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log_double_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log_data.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log2_float_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log2_double_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/impl/log2_data.hpp
set(ccmath_detail_exponential_details_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log_float_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log_double_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log_data.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log2_float_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log2_double_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/details/log2_data.hpp
)

set(ccmath_detail_exponential_headers
${ccmath_detail_exponential_impl_headers}
${ccmath_detail_exponential_details_headers}
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/exp.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/exp2.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/detail/exponential/expm1.hpp
Expand Down Expand Up @@ -190,11 +175,6 @@ set(ccmath_detail_headers
${ccmath_detail_root_headers}
)


##########################################
# Root headers
##########################################

set(ccmath_root_headers
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/basic.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ccmath/compare.hpp
Expand Down
1 change: 1 addition & 0 deletions include/ccmath/detail/basic/abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "ccmath/detail/compare/isnan.hpp"

#include <limits>

namespace ccm
Expand Down
38 changes: 29 additions & 9 deletions include/ccmath/detail/basic/fdim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,34 @@

#include <limits>
#include <type_traits>

#include "ccmath/detail/compare/isnan.hpp"

namespace ccm
{
/// @cond MATH_DETAIL
namespace
{
namespace impl
{
template <typename T>
inline constexpr T fdim_impl(T x, T y)
{
if constexpr (std::is_floating_point_v<T>)
{
if (ccm::isnan(x)) { return x; }
if (ccm::isnan(y)) { return y; }
}

if (x <= y) { return T(+0.0); }
else if ((y < T(0.0)) && (x > (std::numeric_limits<T>::max() + y))) { return std::numeric_limits<T>::infinity(); }
else { return x - y; }
}

} // namespace impl
} // namespace
/// @endcond

/**
* @brief Computes the positive difference of two floating point values (max(0,x−y))
* @tparam T A floating-point type.
Expand All @@ -24,11 +48,7 @@ namespace ccm
template <typename T, std::enable_if_t<std::is_floating_point<T>::value, int> = 0>
inline constexpr T fdim(T x, T y)
{
if (ccm::isnan(x)) { return x; }
if (ccm::isnan(y)) { return y; }
if (x <= y) { return T(+0.0); }
else if ((y < T(0.0)) && (x > (std::numeric_limits<T>::max() + y))) { return std::numeric_limits<T>::infinity(); }
else { return x - y; }
return impl::fdim_impl(x, y);
}

/**
Expand All @@ -46,7 +66,7 @@ namespace ccm
using shared_type = std::common_type_t<T, U>;

// Convert the arguments to the common type
return fdim<shared_type>(static_cast<shared_type>(x), static_cast<shared_type>(y));
return fdim(static_cast<shared_type>(x), static_cast<shared_type>(y));
}

/**
Expand All @@ -59,7 +79,7 @@ namespace ccm
template <typename Integer, std::enable_if_t<std::is_integral<Integer>::value, int> = 0>
inline constexpr double fdim(Integer x, Integer y)
{
return fdim<double>(static_cast<double>(x), static_cast<double>(y));
return fdim(static_cast<double>(x), static_cast<double>(y));
}

/**
Expand All @@ -70,7 +90,7 @@ namespace ccm
*/
inline constexpr float fdimf(float x, float y)
{
return fdim<float>(x, y);
return fdim(x, y);
}

/**
Expand All @@ -81,7 +101,7 @@ namespace ccm
*/
inline constexpr long double fdiml(long double x, long double y)
{
return fdim<long double>(x, y);
return fdim(x, y);
}
} // namespace ccm

Expand Down
124 changes: 0 additions & 124 deletions include/ccmath/detail/basic/impl/remquo_double_impl.hpp

This file was deleted.

Loading

0 comments on commit 25f3f93

Please sign in to comment.