27template<
typename T,
typename U>
29 const auto value =
static_cast<T
>(
exp);
31 constexpr auto inf = std::numeric_limits<T>::infinity();
33 std::nextafter(value, inf));
44 if(a.
lower() < T(0)) {
45 throw std::domain_error(
"Interval has negative values.");
61 if(a.
lower() <= T(0)) {
62 throw std::domain_error(
"Interval has non-positive values.");
67template<
typename T,
typename U>
75 throw std::domain_error(
76 "Can not raise an interval containing 0 to a negative power.");
86 if(a.
lower() < T(0)) {
87 throw std::domain_error(
"Can not raise an interval with negative "
88 "values to a non-integer power.");
93 boost::numeric::log(x));
97 const auto power =
static_cast<long long>(
exp);
99 boost::numeric::pow(x,
static_cast<int>(power)));
110 if(exponent.
width() == T(0)) {
return pow(a, exponent.
lower()); }
Models a closed numeric interval.
Definition interval.hpp:29
value_t width() const
Returns the distance between the interval's bounds.
Definition interval.hpp:73
value_t lower() const
Returns the lower bound of the interval.
Definition interval.hpp:116
bool contains(value_t value) const
Whether a scalar lies in this interval.
Definition interval.hpp:144
bool empty() const
Is *this the empty interval?
Definition interval.hpp:108
Conversions between sigma::Interval and the boost interval it wraps.
The namespace that contains the implementation details of the library.
Definition convert.hpp:18
Interval< T > from_boost_(const boost_interval_t< T > &x)
Convert a boost interval into a sigma::Interval.
Definition convert.hpp:48
boost_interval_t< T > exponent_interval_(const U &exp)
The exponent of a non-integer pow(), as an interval.
Definition exponents.ipp:28
boost_interval_t< T > to_boost_(const Interval< T > &a)
Convert a sigma::Interval into the boost interval it wraps.
Definition convert.hpp:31
boost::numeric::interval< T, interval_policies_t< T > > boost_interval_t
The boost interval type sigma::Interval wraps.
Definition policies.hpp:485
The primary namespace for the sigma library.
Definition affine.hpp:12
Affine< T > exp(const Affine< T > &a)
Calculate the exponential of an affine form.
Definition exponents.ipp:31
Affine< T > pow(const Affine< T > &a, const U &exp)
Calculate the power of an affine form.
Definition exponents.ipp:72
Affine< T > log(const Affine< T > &a)
Calculate the natural logarithm of an affine form.
Definition exponents.ipp:51
Affine< T > sqrt(const Affine< T > &a)
Calculate the square root of an affine form.
Definition exponents.ipp:9
Small numeric helpers shared across Sigma's representations.
bool is_integer_exponent(const U &exp)
True if exp has no fractional part.
Definition numeric.hpp:27