No, the class is a very thin wrapper around mpfi so there's practically no error checking. I really should add some error checks to the functions that create new intervals (i.e. assignment operators from two "components"): I'll do that shortly.
Here's the patch for better error checks going in Trunk, hopefully that
should stop most invalid intervals from ever occurring in the first place:
Index: mpfi.hpp
===================================================================
--- mpfi.hpp (revision 86537)
+++ mpfi.hpp (working copy)
@@ -179,6 +179,8 @@
}
mpfi_float_imp& operator = (const char* s)
{
+ using default_ops::eval_fpclassify;
+
if(m_data[0].left._mpfr_d == 0)
mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ?
digits10 : get_default_precision()));
@@ -203,7 +205,22 @@
part.erase();
b = part.c_str();
- mpfi_interv_fr(m_data, a.data(), b.data());
+ if(eval_fpclassify(a) == FP_NAN)
+ {
+ mpfi_set_fr(this->data(), a.data());
+ }
+ else if(eval_fpclassify(b) == FP_NAN)
+ {
+ mpfi_set_fr(this->data(), b.data());
+ }
+ else
+ {
+ if(a.compare(b) > 0)
+ {
+ BOOST_THROW_EXCEPTION(std::runtime_error("Attempt to create
interval with invalid range (start is greater than end)."));
+ }
+ mpfi_interv_fr(m_data, a.data(), b.data());
+ }
}
else if(mpfi_set_str(m_data, s, 10) != 0)
{
@@ -745,7 +762,23 @@
template