Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package boost for openSUSE:Factory checked in at 2022-05-30 12:42:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/boost (Old) and /work/SRC/openSUSE:Factory/.boost.new.2254 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "boost" Mon May 30 12:42:10 2022 rev:156 rq:979713 version:1.79.0 Changes: -------- --- /work/SRC/openSUSE:Factory/boost/boost.changes 2022-04-23 00:24:47.719734885 +0200 +++ /work/SRC/openSUSE:Factory/.boost.new.2254/boost.changes 2022-05-30 12:42:26.392269911 +0200 @@ -1,0 +2,7 @@ +Sun May 29 12:51:47 UTC 2022 - Stefan Br??ns <stefan.bru...@rwth-aachen.de> + +- Fix failing conversion of cpp_dec_float to double, depending on + locale (gh#boostorg/multiprecision#464, boo#1199968). + Add boost-mp-locale-fix.patch + +------------------------------------------------------------------- New: ---- boost-mp-locale-fix.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ boost.spec ++++++ --- /var/tmp/diff_new_pack.4i0RRi/_old 2022-05-30 12:42:27.976272019 +0200 +++ /var/tmp/diff_new_pack.4i0RRi/_new 2022-05-30 12:42:27.980272024 +0200 @@ -266,6 +266,7 @@ Patch21: boost-remove-cmakedir.patch Patch22: boost-process.patch Patch23: https://www.boost.org/patches/1_79_0/0001-json-array-erase-relocate.patch +Patch24: boost-mp-locale-fix.patch BuildRequires: fdupes BuildRequires: gmp-devel BuildRequires: libbz2-devel @@ -1260,6 +1261,7 @@ %patch21 -p1 %patch22 -p2 %patch23 -p1 +%patch24 -p1 %build find . -type f -exec chmod u+w {} + ++++++ boost-mp-locale-fix.patch ++++++ >From b30cfbb5dd7bf0a03730a5e25d35b4fd61add6e7 Mon Sep 17 00:00:00 2001 From: Matt Borland <m...@mattborland.com> Date: Sat, 28 May 2022 08:53:35 -0700 Subject: [PATCH] Fix for issue #464 --- .../boost/multiprecision/cpp_dec_float.hpp | 22 +++++++++++-- test/Jamfile.v2 | 1 + test/git_issue_464.cpp | 31 +++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/git_issue_464.cpp diff --git a/include/boost/multiprecision/cpp_dec_float.hpp b/include/boost/multiprecision/cpp_dec_float.hpp index bed38d5cf..074073827 100644 --- a/boost/multiprecision/cpp_dec_float.hpp +++ b/boost/multiprecision/cpp_dec_float.hpp @@ -26,6 +26,8 @@ #include <string> #include <limits> #include <stdexcept> +#include <sstream> +#include <locale> #include <boost/multiprecision/detail/standalone_config.hpp> #include <boost/multiprecision/number.hpp> #include <boost/multiprecision/detail/fpclassify.hpp> @@ -1603,7 +1605,15 @@ double cpp_dec_float<Digits10, ExponentType, Allocator>::extract_double() const : -std::numeric_limits<double>::infinity()); } - return std::strtod(str(std::numeric_limits<double>::digits10 + (2 + 1), std::ios_base::scientific).c_str(), nullptr); + std::stringstream ss; + ss.imbue(std::locale::classic()); + + ss << str(std::numeric_limits<double>::digits10 + (2 + 1), std::ios_base::scientific); + + double d; + ss >> d; + + return d; } template <unsigned Digits10, class ExponentType, class Allocator> @@ -1642,7 +1652,15 @@ long double cpp_dec_float<Digits10, ExponentType, Allocator>::extract_long_doubl : -std::numeric_limits<long double>::infinity()); } - return std::strtold(str(std::numeric_limits<long double>::digits10 + (2 + 1), std::ios_base::scientific).c_str(), nullptr); + std::stringstream ss; + ss.imbue(std::locale::classic()); + + ss << str(std::numeric_limits<long double>::digits10 + (2 + 1), std::ios_base::scientific); + + long double ld; + ss >> ld; + + return ld; } template <unsigned Digits10, class ExponentType, class Allocator> diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4ad012273..f5d88edf2 100644 --- a/libs/multiprecision/test/Jamfile.v2 +++ b/libs/multiprecision/test/Jamfile.v2 @@ -1176,6 +1176,7 @@ test-suite misc : [ run git_issue_426.cpp : : : [ check-target-builds ../config//has_mpfr : <source>gmp <source>mpfr <define>TEST_MPFR ] [ check-target-builds ../config//has_float128 : <source>quadmath <define>TEST_FLOAT128 ] ] [ run git_issue_277.cpp ] [ run git_issue_313.cpp ] + [ run git_issue_464.cpp ] [ compile git_issue_98.cpp : [ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ] [ check-target-builds ../config//has_gmp : <define>TEST_GMP <source>gmp : ] diff --git a/test/git_issue_464.cpp b/test/git_issue_464.cpp new file mode 100644 index 000000000..dc9d0054a --- /dev/null +++ b/libs/multiprecision/test/git_issue_464.cpp @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright 2022 Matt Borland. 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) +// +// See: https://github.com/boostorg/multiprecision/issues/464 + +#include <boost/multiprecision/cpp_dec_float.hpp> +#include <locale> +#include "test.hpp" + +template <typename T> +void test() +{ + auto a = boost::multiprecision::cpp_dec_float_50 {12345}; + + auto d1 = a.convert_to<T>(); + + std::locale::global(std::locale("de_DE")); + auto d2 = a.convert_to<T>(); + + BOOST_CHECK_EQUAL(d1, d2); +} + +int main(void) +{ + test<double>(); + test<long double>(); + + return boost::report_errors(); +}