Add expanded reproducer test set

This commit is contained in:
Matt Borland
2026-04-30 13:29:00 -04:00
parent 965194a938
commit a70cc0d828
2 changed files with 69 additions and 0 deletions
+1
View File
@@ -1281,6 +1281,7 @@ test-suite misc :
[ run git_issue_636.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
[ run git_issue_652.cpp ]
[ run git_issue_734.cpp ]
[ run git_issue_759.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
[ compile git_issue_98.cpp :
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]
[ check-target-builds ../config//has_gmp : <define>TEST_GMP <source>gmp : ]
+68
View File
@@ -0,0 +1,68 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2026 Matt Borland. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See: https://github.com/boostorg/multiprecision/issues/759
#include <complex>
#include <iostream>
#include <limits>
#include <boost/multiprecision/float128.hpp>
#include "test.hpp"
int main()
{
using REAL = boost::multiprecision::float128;
const REAL inf_v = std::numeric_limits<REAL>::infinity();
{
using std::abs;
const REAL r = abs(inf_v);
BOOST_CHECK((boost::multiprecision::isinf)(r));
}
{
using std::abs;
const std::complex<REAL> z{inf_v, REAL(0)};
const REAL r = abs(z);
BOOST_CHECK((boost::multiprecision::isinf)(r));
BOOST_CHECK(!(boost::multiprecision::isnan)(r));
}
{
using std::abs;
const std::complex<REAL> z{REAL(0), inf_v};
const REAL r = abs(z);
BOOST_CHECK((boost::multiprecision::isinf)(r));
BOOST_CHECK(!(boost::multiprecision::isnan)(r));
}
{
using std::abs;
const std::complex<REAL> z{-inf_v, REAL(3)};
const REAL r = abs(z);
BOOST_CHECK((boost::multiprecision::isinf)(r));
BOOST_CHECK(!(boost::multiprecision::isnan)(r));
}
{
// Per IEEE 754: hypot(inf, NaN) = inf.
using std::abs;
const REAL nan_v = std::numeric_limits<REAL>::quiet_NaN();
const std::complex<REAL> z{inf_v, nan_v};
const REAL r = abs(z);
BOOST_CHECK((boost::multiprecision::isinf)(r));
}
{
// Sanity check on a finite value: abs(3 + 4i) == 5.
using std::abs;
const std::complex<REAL> z{REAL(3), REAL(4)};
const REAL r = abs(z);
BOOST_CHECK_EQUAL(r, REAL(5));
}
return boost::report_errors();
}