forked from boostorg/multiprecision
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from BoostGSoC21/igamma_inv
Fix #131 via tune elem and special funcs
- Loading branch information
Showing
9 changed files
with
316 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
include/boost/multiprecision/cpp_df_qf/cpp_df_qf_detail_ccmath_fpclassify.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.