Add patch for fixing a test failure in Boost.Random

the patch addresses a test failure in Boost.Random:
```
terminate called after throwing an instance of 'boost::wrapexcept<std::overflow_error>'
  what():  Error in function float_next<double>(double): Overflow Error
Running 21 test cases...
unknown location(0): fatal error: in "distributions_test<boost__random__piecewise_constant_distribution<boost__multiprecision__number<boost__multiprecision__backends__cpp_bin_float<100u_ (boost__multiprecision__backends__digit_base_type)10_ void_ int_ 0_ 0>_ (boost__multiprecision__expression_template_option)1>_ double>>": signal: SIGABRT (application abort requested)
multiprecision_float_test.cpp(115): last checkpoint
```

The backported patch is included by boost 1.84
See https://github.com/boostorg/random/pull/88

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2024-06-07 18:51:49 +08:00 committed by Jonathan Wakely
commit 0276e583db
2 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,30 @@
From 4239d93dad32a11e4c3829050f8070d456266133 Mon Sep 17 00:00:00 2001
From: jzmaddock <john@johnmaddock.co.uk>
Date: Wed, 1 Jun 2022 19:35:36 +0100
Subject: [PATCH] Update multiprecision_float_test.cpp to not overflow type
double. Previously the max value for uint1024_t could just squeeze into a
double because truncation occurred during the conversion, now that cpp_int
performs correctly rounded conversions, overflow occurs, and the computation
fails. Changed the problem distribution to use a multiprecision weight type,
rather than double.
---
test/multiprecision_float_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/multiprecision_float_test.cpp b/test/multiprecision_float_test.cpp
index bc2a936..2b53483 100644
--- a/libs/random/test/multiprecision_float_test.cpp
+++ b/libs/random/test/multiprecision_float_test.cpp
@@ -77,7 +77,7 @@ typedef boost::mpl::list <
boost::random::lognormal_distribution<big_float>,
boost::random::normal_distribution<big_float>,
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
- boost::random::piecewise_constant_distribution<big_float>,
+ boost::random::piecewise_constant_distribution<big_float, big_float>,
boost::random::piecewise_linear_distribution<big_float>,
#endif
boost::random::student_t_distribution<big_float>,
--
2.45.2

View file

@ -42,7 +42,7 @@ Name: boost
%global real_name boost
Summary: The free peer-reviewed portable C++ source libraries
Version: 1.81.0
Release: 9%{?dist}
Release: 10%{?dist}
License: BSL-1.0 AND MIT AND Python-2.0.1
# Replace each . with _ in %%{version}
@ -159,6 +159,9 @@ Patch7: boost-1.81.0-always-initialize-member-variable.patch
# https://github.com/boostorg/math/issues/1132
Patch8: boost-1.83-math-Correct-float_next-INF-and-float_prior-INF.patch
# https://github.com/boostorg/random/pull/88
Patch9: boost-1.84-random-test-overflow.patch
%bcond_with tests
%bcond_with docs_generated
@ -1288,6 +1291,9 @@ fi
%{_mandir}/man1/b2.1*
%changelog
* Fri Jun 07 2024 Kefu Chai <tchaikov@fedoraproject.org> - 1.81.0-10
- Add patch to fix test failure in Boost.Random.
* Sat May 25 2024 Kefu Chai <tchaikov@fedoraproject.org> - 1.81.0-9
- Add patch to fix Boost.Math bug where float_next(+INF) and float_prior(-INF)
returns NaN, but they should return +INF and -INF respectively.