Skip to content

Commit

Permalink
Merge pull request boostorg#552 from boostorg/issue551
Browse files Browse the repository at this point in the history
Make sure changing the global precision options also changes the valu…
  • Loading branch information
jzmaddock authored May 2, 2023
2 parents 697f774 + 1b8d151 commit 97b27c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/boost/multiprecision/number.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ class number
static BOOST_MP_CXX14_CONSTEXPR void default_variable_precision_options(variable_precision_options opts)
{
Backend::default_variable_precision_options(opts);
Backend::thread_default_variable_precision_options(opts);
}
static BOOST_MP_CXX14_CONSTEXPR void thread_default_variable_precision_options(variable_precision_options opts)
{
Expand Down
5 changes: 4 additions & 1 deletion test/test_preserve_target_precision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ template <class T>
void test()
{
T::thread_default_precision(100);
T::thread_default_variable_precision_options(boost::multiprecision::variable_precision_options::preserve_target_precision);
T::default_variable_precision_options(boost::multiprecision::variable_precision_options::preserve_target_precision);

BOOST_CHECK_EQUAL((int)T::default_variable_precision_options(), (int)boost::multiprecision::variable_precision_options::preserve_target_precision);
BOOST_CHECK_EQUAL((int)T::thread_default_variable_precision_options(), (int)boost::multiprecision::variable_precision_options::preserve_target_precision);

T hp1("0.1"), hp2("0.3"), hp3("0.11"), hp4("0.1231");

Expand Down

0 comments on commit 97b27c4

Please sign in to comment.