AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
|
#include "probfd/interval.h"
Represents a closed interval over the extended reals as a pair of lower and upper bound.
Public Member Functions | |
Interval (value_t val=0_vt) | |
Constructs an interval consisting of a single point p. | |
Interval (value_t lb, value_t ub) | |
Constructs an interval from a specified lower and upper bound. | |
Interval & | operator+= (Interval rhs) |
Equivalent to *this = *this + rhs. | |
Interval & | operator*= (value_t scale_factor) |
Equivalent to *this = factor * (*this) | |
double | length () const |
Returns the length of the interval. If both bounds are infinity and have the same sign, returns 0. | |
bool | bounds_approximately_equal (value_t tolerance=g_epsilon) const |
Checks if the length is below a given tolerance. | |
Public Attributes | |
value_t | lower |
The Lower bound of the interval. | |
value_t | upper |
The upper bound of the interval. | |
|
explicit |
Constructs an interval consisting of a single point p.
Constructs an interval from a specified lower and upper bound.
Equivalent to *this = factor * (*this)
|
nodiscard |
Returns the length of the interval. If both bounds are infinity and have the same sign, returns 0.
Checks if the length is below a given tolerance.
value_t probfd::Interval::lower |
The Lower bound of the interval.
value_t probfd::Interval::upper |
The upper bound of the interval.