-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
BugSomething isn't workingSomething isn't working
Description
#define BOOST_DECIMAL_DETAIL_INT128_NO_CONSTEVAL_DETECTION
#include <boost/decimal.hpp>
#include <boost/core/lightweight_test.hpp>
template <typename T>
void test()
{
const T lhs {"1E34"};
const T rhs {"-0.51"};
const T res {"9999999999999999999999999999999999"};
const T add_val {lhs + rhs};
BOOST_TEST_EQ(add_val, res);
const T sub_val {lhs - boost::decimal::abs(rhs)};
BOOST_TEST_EQ(sub_val, res);
}
int main()
{
// TODO(mborland): GCC 12+ in 32 bit compilations only with release mode fail
#if 1
test<boost::decimal::decimal128_t>();
test<boost::decimal::decimal_fast128_t>();
#endif
return boost::report_errors();
}
If we define no consteval detection the result becomes correct, without its:
/home/mborland/Documents/boost/libs/decimal/test/github_issue_1260.cpp(20): test 'add_val == res' ('9999999999999999999999999999999990' == '9999999999999999999999999999999999') failed in function 'void test() [with T = boost::decimal::decimal128_t]'
/home/mborland/Documents/boost/libs/decimal/test/github_issue_1260.cpp(23): test 'sub_val == res' ('9999999999999999999999999999999990' == '9999999999999999999999999999999999') failed in function 'void test() [with T = boost::decimal::decimal128_t]'
/home/mborland/Documents/boost/libs/decimal/test/github_issue_1260.cpp(20): test 'add_val == res' ('9999999999999999999999999999999990' == '9999999999999999999999999999999999') failed in function 'void test() [with T = boost::decimal::decimal_fast128_t]'
/home/mborland/Documents/boost/libs/decimal/test/github_issue_1260.cpp(23): test 'sub_val == res' ('9999999999999999999999999999999990' == '9999999999999999999999999999999999') failed in function 'void test() [with T = boost::decimal::decimal_fast128_t]'
4 errors detected.
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working