Skip to content

Commit

Permalink
Merge pull request #158 from BoostGSoC21/igamma_inv
Browse files Browse the repository at this point in the history
Fix #131 via tune elem and special funcs
  • Loading branch information
ckormanyos authored Dec 29, 2024
2 parents d1871ca + 0a51d96 commit 2f5c93a
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 65 deletions.
10 changes: 6 additions & 4 deletions include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ struct exact_arithmetic

static constexpr auto normalize(float_pair& result, float_type a, float_type b) -> void
{
// Converts a pair of floats to standard form.
const float_pair tmp = fast_sum(a, b);
float_type u { a + b };
float_type v { a - u };

result.first = tmp.first;
result.second = tmp.second;
v = v + b;

result.first = u;
result.second = v;
}

static constexpr auto split(const float_type& a) -> float_pair
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fabs.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fma.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fpclassify.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_frexp.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isinf.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isnan.hpp>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2024.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_MP_CPP_DF_QF_DETAIL_CCMATH_FPCLASSIFY_2024_12_26_HPP
#define BOOST_MP_CPP_DF_QF_DETAIL_CCMATH_FPCLASSIFY_2024_12_26_HPP

#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fabs.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isinf.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_isnan.hpp>
#include <boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_limits.hpp>

#include <cmath>

namespace boost { namespace multiprecision { namespace backends { namespace cpp_df_qf_detail { namespace ccmath {

template <typename T>
constexpr auto fpclassify(T x) -> typename std::enable_if<!std::is_integral<T>::value, int>::type
{
if ((boost::multiprecision::backends::cpp_df_qf_detail::ccmath::isnan)(x))
{
return FP_NAN;
}
else if ((boost::multiprecision::backends::cpp_df_qf_detail::ccmath::isinf)(x))
{
return FP_INFINITE;
}
else
{
const T fabs_x { boost::multiprecision::backends::cpp_df_qf_detail::ccmath::fabs(x) };

if (fabs_x == T(0))
{
return FP_ZERO;
}
else if ((fabs_x > 0) && (fabs_x < (boost::multiprecision::backends::cpp_df_qf_detail::ccmath::numeric_limits<T>::min)()))
{
return FP_SUBNORMAL;
}
else
{
return FP_NORMAL;
}
}
}

} } } } } // namespace boost::multiprecision::backends::cpp_df_qf_detail::ccmath

#endif // BOOST_MP_CPP_DF_QF_DETAIL_CCMATH_FPCLASSIFY_2024_12_26_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace boost { namespace multiprecision { namespace backends { namespace cpp_df_qf_detail { namespace ccmath {

template <class FloatingPointType>
constexpr bool isnan(FloatingPointType x)
constexpr auto isnan(FloatingPointType x) -> bool
{
return (x != x);
}
Expand Down
Loading

0 comments on commit 2f5c93a

Please sign in to comment.