Skip to content

Commit be8d7f5

Browse files
committed
Reduce waste now exp uses expm1_impl
1 parent a145fdc commit be8d7f5

File tree

3 files changed

+6
-150
lines changed

3 files changed

+6
-150
lines changed

include/boost/decimal/detail/cmath/exp.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// Copyright 2023 Matt Borland
2-
// Copyright 2023 Christopher Kormanyos
1+
// Copyright 2023 - 2024 Matt Borland
2+
// Copyright 2023 - 2024 Christopher Kormanyos
33
// Distributed under the Boost Software License, Version 1.0.
44
// https://www.boost.org/LICENSE_1_0.txt
55

66
#ifndef BOOST_DECIMAL_DETAIL_CMATH_EXP_HPP
77
#define BOOST_DECIMAL_DETAIL_CMATH_EXP_HPP
88

99
#include <boost/decimal/fwd.hpp> // NOLINT(llvm-include-order)
10-
#include <boost/decimal/detail/cmath/impl/exp_impl.hpp>
10+
#include <boost/decimal/detail/cmath/impl/expm1_impl.hpp>
1111
#include <boost/decimal/detail/cmath/impl/pow_impl.hpp>
1212
#include <boost/decimal/detail/type_traits.hpp>
1313
#include <boost/decimal/detail/concepts.hpp>
@@ -76,7 +76,7 @@ constexpr auto exp_impl(T x) noexcept
7676
x -= numbers::ln2_v<T> * nf2;
7777
}
7878

79-
result = detail::exp_pade_appxroximant_or_series(x);
79+
result = fma(x, detail::expm1_series_expansion(x), one);
8080

8181
if (nf2 > 0)
8282
{

include/boost/decimal/detail/cmath/impl/exp_impl.hpp

Lines changed: 0 additions & 144 deletions
This file was deleted.

test/test_exp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ auto main() -> int
355355
const auto result_pos_lo_is_ok = local::test_exp<decimal_type, float_type>(512, false, 0.03125L, 80.0L);
356356
const auto result_neg_lo_is_ok = local::test_exp<decimal_type, float_type>(512, true, 0.03125L, 80.0L);
357357

358-
const auto result_pos_hi_is_ok = local::test_exp<decimal_type, float_type>(3072, false, 8.0L, 512.0L);
359-
const auto result_neg_hi_is_ok = local::test_exp<decimal_type, float_type>(3072, true, 8.0L, 512.0L);
358+
const auto result_pos_hi_is_ok = local::test_exp<decimal_type, float_type>(2048, false, 8.0L, 512.0L);
359+
const auto result_neg_hi_is_ok = local::test_exp<decimal_type, float_type>(2048, true, 8.0L, 512.0L);
360360

361361
const auto result_edge_is_ok = local::test_exp_edge<decimal_type, float_type>();
362362

0 commit comments

Comments
 (0)