Skip to content

Commit fd78a3c

Browse files
committed
Attempt fix Cygwin failure
1 parent 6402189 commit fd78a3c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/test_float_special.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import boost.safe_numbers;
2727
#endif
2828

2929
#include <cmath>
30+
#include <exception>
3031
#include <limits>
3132
#include <stdexcept>
3233

@@ -50,14 +51,18 @@ void test_finite()
5051
BOOST_TEST(tgamma(T{static_cast<basis_type>(0.5)}) == T{std::tgamma(static_cast<basis_type>(0.5))});
5152
}
5253

53-
// tgamma at a negative integer produces NAN -> domain_error
54+
// tgamma at a negative integer is a pole. Most standard libraries report it as a
55+
// NAN (so it surfaces as std::domain_error), but newlib/Cygwin returns an infinity
56+
// (so it surfaces as std::overflow_error or std::underflow_error). The portable
57+
// invariant is only that the non-finite result is rejected, so accept any of them
58+
// via their common base std::exception.
5459
template <typename T>
5560
void test_domain()
5661
{
5762
using basis_type = typename T::basis_type;
5863

59-
BOOST_TEST_THROWS(tgamma(T{static_cast<basis_type>(-1.0)}), std::domain_error);
60-
BOOST_TEST_THROWS(tgamma(T{static_cast<basis_type>(-2.0)}), std::domain_error);
64+
BOOST_TEST_THROWS(tgamma(T{static_cast<basis_type>(-1.0)}), std::exception);
65+
BOOST_TEST_THROWS(tgamma(T{static_cast<basis_type>(-2.0)}), std::exception);
6166
}
6267

6368
// tgamma(0) and lgamma(0) are poles producing +inf -> overflow_error.

0 commit comments

Comments
 (0)