diff --git a/include/boost/decimal/decimal128_fast.hpp b/include/boost/decimal/decimal128_fast.hpp index 0e12d320f..4d8d80ee6 100644 --- a/include/boost/decimal/decimal128_fast.hpp +++ b/include/boost/decimal/decimal128_fast.hpp @@ -1370,7 +1370,7 @@ constexpr auto scalblnd128f(decimal128_fast num, long exp) noexcept -> decimal12 } #endif - num.exponent_ = static_cast(static_cast(num.biased_exponent()) + exp); + num = decimal128_fast(num.significand_, num.biased_exponent() + exp, num.sign_); return num; } diff --git a/test/Jamfile b/test/Jamfile index 16a1f9a88..2067c481a 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -51,6 +51,7 @@ run github_issue_448.cpp ; run-fail github_issue_519.cpp ; run github_issue_799.cpp ; run github_issue_802.cpp ; +run github_issue_805.cpp ; run link_1.cpp link_2.cpp link_3.cpp ; run quick.cpp ; run random_decimal32_comp.cpp ; diff --git a/test/github_issue_805.cpp b/test/github_issue_805.cpp new file mode 100644 index 000000000..04084d012 --- /dev/null +++ b/test/github_issue_805.cpp @@ -0,0 +1,31 @@ +// Copyright 2025 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +using namespace boost::decimal; + +template +void test() +{ + Dec a(2, std::numeric_limits::max_exponent10); + Dec b = scalbln(a, 10); + + BOOST_TEST(isinf(b)); +} + +int main() +{ + test(); + test(); + test(); + test(); + test(); + test(); + + return boost::report_errors(); +} +