Skip to content

Commit ebd0d82

Browse files
authored
Merge pull request #761 from boostorg/743
Add `data()` member to float128
2 parents d6de341 + 9bd84a2 commit ebd0d82

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

include/boost/multiprecision/float128.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ struct float128_backend
296296
{
297297
return m_value;
298298
}
299+
BOOST_MP_CXX14_CONSTEXPR float128_type& data()
300+
{
301+
return m_value;
302+
}
303+
BOOST_MP_CXX14_CONSTEXPR const float128_type& data() const
304+
{
305+
return m_value;
306+
}
299307
};
300308

301309
inline BOOST_MP_CXX14_CONSTEXPR void eval_add(float128_backend& result, const float128_backend& a)

test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ test-suite misc :
12811281
[ run git_issue_636.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
12821282
[ run git_issue_652.cpp ]
12831283
[ run git_issue_734.cpp ]
1284+
[ run git_issue_743.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
12841285
[ run git_issue_759.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
12851286
[ compile git_issue_98.cpp :
12861287
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]

test/git_issue_743.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
// Copyright 2026 Matt Borland. Distributed under the Boost
3+
// Software License, Version 1.0. (See accompanying file
4+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
//
6+
// See: https://github.com/boostorg/multiprecision/issues/743
7+
8+
#include <boost/multiprecision/float128.hpp>
9+
#include "test.hpp"
10+
11+
int main()
12+
{
13+
using real = boost::multiprecision::float128;
14+
15+
constexpr real value {5};
16+
BOOST_CHECK(value.backend().value() == value.backend().data());
17+
18+
real mutable_value {42};
19+
BOOST_CHECK(mutable_value.backend().value() == mutable_value.backend().data());
20+
21+
return boost::report_errors();
22+
}

0 commit comments

Comments
 (0)