Boost logo

Boost Users :

Subject: Re: [Boost-users] [multiprecision] Empty intervals and intervals withNaN check
From: John Maddock (john_at_[hidden])
Date: 2013-11-21 06:37:40


> In MPFI documentation it is said that "MPFI functions operate on valid
> intervals ..., their behavior with non-valid intervals as input is
> undefined".
> Are intervals checked in Boost Multiprecision library whether they are
> invalid? Can this be easily done using Boost?
> Kind regards, Petr.

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.

You can check intervals yourself by accessing the individual components, for
example with:

assert(lower(my_interval) <= upper(my_interval));

You can also get the underlying mpfi_t via:

my_interval.backend().data();

Checking for infinities/NaN's etc can be done with the usual

isinf, isnan, isfinite, fpclassify etc.

These rely on mpfi's functions internally, I'm not sure what happens to
these if you've managed to create an invalid interval somehow - will check.

HTH, John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net