Skip to content

Commit

Permalink
Merge pull request #156 from BoostGSoC21/further_specfun
Browse files Browse the repository at this point in the history
Further specfun
  • Loading branch information
ckormanyos authored Dec 21, 2024
2 parents 9432444 + 7e117b0 commit cc83437
Showing 1 changed file with 57 additions and 17 deletions.
74 changes: 57 additions & 17 deletions include/boost/multiprecision/cpp_double_fp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,9 @@ class cpp_double_fp_backend
}
else
{
return operator=(cpp_double_fp_backend::my_value_inf());
const bool b_neg { isneg() };

return operator=((!b_neg) ? cpp_double_fp_backend::my_value_inf() : -cpp_double_fp_backend::my_value_inf());
}
}

Expand Down Expand Up @@ -1459,16 +1461,30 @@ template <typename FloatingPointType,
typename ::std::enable_if<(cpp_df_qf_detail::is_floating_point_or_float128<FloatingPointType>::value && ((cpp_df_qf_detail::ccmath::numeric_limits<FloatingPointType>::digits10 * 2) < 16))>::type const*>
constexpr void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
{
const auto x_is_zero = x.is_zero();
const int fpc { eval_fpclassify(x) };

const bool x_is_zero { fpc == FP_ZERO };

if ((eval_fpclassify(x) != FP_NORMAL) && (!x_is_zero))
using double_float_type = cpp_double_fp_backend<FloatingPointType>;

if (fpc == FP_ZERO)
{
result = x;
result = double_float_type(1);
}
else if (fpc != FP_NORMAL)
{
if (fpc == FP_INFINITE)
{
result = (x.isneg() ? double_float_type(0) : double_float_type::my_value_inf());
}
else if (fpc == FP_NAN)
{
result = x;
}
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;
using local_float_type = typename double_float_type::float_type;

// Get a local copy of the argument and force it to be positive.
const auto b_neg = x.is_neg();
Expand Down Expand Up @@ -1601,17 +1617,29 @@ template <typename FloatingPointType,
typename ::std::enable_if<(cpp_df_qf_detail::is_floating_point_or_float128<FloatingPointType>::value && (((cpp_df_qf_detail::ccmath::numeric_limits<FloatingPointType>::digits10 * 2) >= 16) && ((cpp_df_qf_detail::ccmath::numeric_limits<FloatingPointType>::digits10 * 2) <= 36)))>::type const*>
constexpr void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
{
const auto x_is_zero = x.is_zero();
const int fpc { eval_fpclassify(x) };

const auto fpc = eval_fpclassify(x);
const bool x_is_zero { fpc == FP_ZERO };

if ((fpc != FP_NORMAL) && (!x_is_zero))
using double_float_type = cpp_double_fp_backend<FloatingPointType>;

if (fpc == FP_ZERO)
{
result = x;
result = double_float_type(1);
}
else if (fpc != FP_NORMAL)
{
if (fpc == FP_INFINITE)
{
result = (x.isneg() ? double_float_type(0) : double_float_type::my_value_inf());
}
else if (fpc == FP_NAN)
{
result = x;
}
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;

// Get a local copy of the argument and force it to be positive.
Expand Down Expand Up @@ -1745,18 +1773,30 @@ template <typename FloatingPointType,
typename ::std::enable_if<(cpp_df_qf_detail::is_floating_point_or_float128<FloatingPointType>::value && ((cpp_df_qf_detail::ccmath::numeric_limits<FloatingPointType>::digits10 * 2) > 36))>::type const*>
constexpr void eval_exp(cpp_double_fp_backend<FloatingPointType>& result, const cpp_double_fp_backend<FloatingPointType>& x)
{
const auto x_is_zero = x.is_zero();
const int fpc { eval_fpclassify(x) };

const auto fpc = eval_fpclassify(x);
const bool x_is_zero { fpc == FP_ZERO };

if ((fpc != FP_NORMAL) && (!x_is_zero))
using double_float_type = cpp_double_fp_backend<FloatingPointType>;

if (fpc == FP_ZERO)
{
result = x;
result = double_float_type(1);
}
else if (fpc != FP_NORMAL)
{
if (fpc == FP_INFINITE)
{
result = (x.isneg() ? double_float_type(0) : double_float_type::my_value_inf());
}
else if (fpc == FP_NAN)
{
result = x;
}
}
else
{
using double_float_type = cpp_double_fp_backend<FloatingPointType>;
using local_float_type = typename double_float_type::float_type;
using local_float_type = typename double_float_type::float_type;

// Get a local copy of the argument and force it to be positive.
const auto b_neg = x.is_neg();
Expand Down

0 comments on commit cc83437

Please sign in to comment.