代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/boost 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7561690135c67ecf88c2133bad7680ebd2665c36 Mon Sep 17 00:00:00 2001
From: jzmaddock <[email protected]>
Date: Wed, 1 Jun 2022 19:32:55 +0100
Subject: [PATCH] Update multiprecision_int_test.cpp to not accidentality
overflow type double. Multiprecision now performs correct rounding when
converting to double - previously the max value for uint1024_t would just fit
in a double if it was truncated. But now that it's correctly rounded it
overflows and breaks the calculation.
---
libs/random/test/multiprecision_int_test.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libs/random/test/multiprecision_int_test.cpp b/libs/random/test/multiprecision_int_test.cpp
index 41ec229..a861cca 100644
--- a/libs/random/test/multiprecision_int_test.cpp
+++ b/libs/random/test/multiprecision_int_test.cpp
@@ -215,8 +215,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(discrete_distributions, distribution_type, other_d
distribution_type d2;
ss >> d2;
BOOST_CHECK(d == d2);
-
- boost::random::independent_bits_engine<boost::random::mt19937, std::numeric_limits<boost::multiprecision::uint1024_t>::digits, boost::multiprecision::uint1024_t > big_random;
+ //
+ // The number of digits in the independent_bits_engine must be low enough that we don't overflow
+ // when converting to a double (see other_distributions declared above).
+ //
+ boost::random::independent_bits_engine<boost::random::mt19937, std::numeric_limits<boost::multiprecision::uint1024_t>::digits - 2, boost::multiprecision::uint1024_t > big_random;
for(unsigned i = 0; i < 200; ++i)
{
result_type r = d(big_random);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。