|
PPL
0.12.1
|
A floating point expression on a given format. More...
#include <Floating_Point_Expression.defs.hh>

Public Types | |
| typedef Linear_Form < FP_Interval_Type > | FP_Linear_Form |
Alias for a linear form with template argument FP_Interval_Type. | |
| typedef Box< FP_Interval_Type > | FP_Interval_Abstract_Store |
| Alias for a map that associates a variable index to an interval. | |
| typedef std::map < dimension_type, FP_Linear_Form > | FP_Linear_Form_Abstract_Store |
| Alias for a map that associates a variable index to a linear form. | |
| typedef FP_Interval_Type::boundary_type | boundary_type |
| The floating point format used by the analyzer. | |
| typedef FP_Interval_Type::info_type | info_type |
The interval policy used by FP_Interval_Type. | |
Public Member Functions | |
| virtual | ~Floating_Point_Expression () |
| Destructor. | |
| virtual bool | linearize (const FP_Interval_Abstract_Store &int_store, const FP_Linear_Form_Abstract_Store &lf_store, FP_Linear_Form &result) const =0 |
| Linearizes a floating point expression. | |
Static Public Member Functions | |
| static bool | overflows (const FP_Linear_Form &lf) |
| Verifies if a given linear form overflows. | |
| static void | relative_error (const FP_Linear_Form &lf, FP_Linear_Form &result) |
| Computes the relative error of a given linear form. | |
| static void | intervalize (const FP_Linear_Form &lf, const FP_Interval_Abstract_Store &store, FP_Interval_Type &result) |
Makes result become an interval that overapproximates all the possible values of lf in the interval abstract store store. | |
Static Public Attributes | |
| static FP_Interval_Type | absolute_error = compute_absolute_error() |
| Absolute error. | |
Static Private Member Functions | |
| static FP_Interval_Type | compute_absolute_error () |
| Computes the absolute error. | |
A floating point expression on a given format.
This class represents a concrete floating point expression. This includes constants, floating point variables, binary and unary arithmetic operators.
FP_Interval_Type represents the type of the intervals used in the abstract domain. The interval bounds should have a floating point type.FP_Format represents the floating point format used in the concrete domain. This parameter must be a struct similar to the ones defined in file Float.defs.hh, even though it is sufficient to define the three fields BASE, MANTISSA_BITS and EXPONENT_BIAS. Definition at line 56 of file Floating_Point_Expression.defs.hh.
| typedef FP_Interval_Type::boundary_type Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >::boundary_type |
The floating point format used by the analyzer.
Reimplemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 82 of file Floating_Point_Expression.defs.hh.
| typedef Box<FP_Interval_Type> Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Interval_Abstract_Store |
Alias for a map that associates a variable index to an interval.
Alias for a Box storing lower and upper bounds for floating point variables.
The type a linear form abstract store associating each variable with an interval that correctly approximates its value.
Reimplemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Cast_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 71 of file Floating_Point_Expression.defs.hh.
| typedef Linear_Form<FP_Interval_Type> Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form |
Alias for a linear form with template argument FP_Interval_Type.
Reimplemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Cast_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 61 of file Floating_Point_Expression.defs.hh.
| typedef std::map<dimension_type, FP_Linear_Form> Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >::FP_Linear_Form_Abstract_Store |
Alias for a map that associates a variable index to a linear form.
The type a linear form abstract store associating each variable with a linear form that correctly approximates its value.
Reimplemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Cast_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 79 of file Floating_Point_Expression.defs.hh.
| typedef FP_Interval_Type::info_type Parma_Polyhedra_Library::Floating_Point_Expression< FP_Interval_Type, FP_Format >::info_type |
The interval policy used by FP_Interval_Type.
Reimplemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
Definition at line 85 of file Floating_Point_Expression.defs.hh.
|
inlinevirtual |
|
staticprivate |
Computes the absolute error.
Static helper method that is used to compute the value of the public static field absolute_error.
corresponding to the value of absolute_error Definition at line 95 of file Floating_Point_Expression.templates.hh.
References Parma_Polyhedra_Library::GREATER_OR_EQUAL, Parma_Polyhedra_Library::i_constraint(), and Parma_Polyhedra_Library::LESS_OR_EQUAL.
{
typedef typename Floating_Point_Expression<FP_Interval_Type, FP_Format>
::boundary_type Boundary;
boundary_type omega;
omega = std::max(pow(static_cast<Boundary>(FP_Format::BASE),
static_cast<Boundary>(1 - FP_Format::EXPONENT_BIAS
- FP_Format::MANTISSA_BITS)),
std::numeric_limits<Boundary>::denorm_min());
FP_Interval_Type result;
result.build(i_constraint(GREATER_OR_EQUAL, -omega),
i_constraint(LESS_OR_EQUAL, omega));
return result;
}
|
static |
Makes result become an interval that overapproximates all the possible values of lf in the interval abstract store store.
| lf | The linear form to aproximate. |
| store | The abstract store. |
| result | The linear form that will be modified. |
This method makes result become
, that is an interval defined as:
Definition at line 76 of file Floating_Point_Expression.templates.hh.
References Parma_Polyhedra_Library::Linear_Form< C >::coefficient(), Parma_Polyhedra_Library::Box< ITV >::get_interval(), Parma_Polyhedra_Library::Linear_Form< C >::inhomogeneous_term(), Parma_Polyhedra_Library::Linear_Form< C >::space_dimension(), and Parma_Polyhedra_Library::Box< ITV >::space_dimension().
{
result = FP_Interval_Type(lf.inhomogeneous_term());
dimension_type dimension = lf.space_dimension();
assert(dimension <= store.space_dimension());
for (dimension_type i = 0; i < dimension; ++i) {
FP_Interval_Type current_addend = lf.coefficient(Variable(i));
const FP_Interval_Type& curr_int = store.get_interval(Variable(i));
current_addend *= curr_int;
result += current_addend;
}
return;
}
|
pure virtual |
Linearizes a floating point expression.
Makes result become a linear form that correctly approximates the value of the floating point expression in the given composite abstract store.
| int_store | The interval abstract store. |
| lf_store | The linear form abstract store. |
| result | Becomes the linearized expression. |
true if the linearization succeeded, false otherwise.Formally, if *this represents the expression
, int_store represents the interval abstract store
and lf_store represents the linear form abstract store
, then result will become
if the linearization succeeds.
All variables occurring in the floating point expression MUST have an associated interval in int_store. If this precondition is not met, calling the method causes an undefined behavior.
Implemented in Parma_Polyhedra_Library::Multiplication_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Division_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Difference_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Sum_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Opposite_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Cast_Floating_Point_Expression< FP_Interval_Type, FP_Format >, Parma_Polyhedra_Library::Constant_Floating_Point_Expression< FP_Interval_Type, FP_Format >, and Parma_Polyhedra_Library::Variable_Floating_Point_Expression< FP_Interval_Type, FP_Format >.
|
inlinestatic |
Verifies if a given linear form overflows.
| lf | The linear form to verify. |
false if all coefficients in lf are bounded, true otherwise. Definition at line 40 of file Floating_Point_Expression.inlines.hh.
References Parma_Polyhedra_Library::Linear_Form< C >::coefficient(), Parma_Polyhedra_Library::Linear_Form< C >::inhomogeneous_term(), and Parma_Polyhedra_Library::Linear_Form< C >::space_dimension().
{
if (!lf.inhomogeneous_term().is_bounded())
return true;
dimension_type dimension = lf.space_dimension();
for (dimension_type i = 0; i < dimension; ++i) {
if (!lf.coefficient(Variable(i)).is_bounded())
return true;
}
return false;
}
|
static |
Computes the relative error of a given linear form.
Static helper method that is used by linearize to account for the relative errors on lf.
| lf | The linear form used to compute the relative error. |
| result | Becomes the linear form corresponding to a relative error committed on lf. |
This method makes result become a linear form obtained by evaluating the function
on the linear form lf. This function is defined such as:
where p is the fraction size in bits for the format
and
the base.
Definition at line 36 of file Floating_Point_Expression.templates.hh.
References Parma_Polyhedra_Library::Linear_Form< C >::coefficient(), Parma_Polyhedra_Library::GREATER_OR_EQUAL, Parma_Polyhedra_Library::i_constraint(), Parma_Polyhedra_Library::Linear_Form< C >::inhomogeneous_term(), Parma_Polyhedra_Library::LESS_OR_EQUAL, and Parma_Polyhedra_Library::Linear_Form< C >::space_dimension().
{
FP_Interval_Type error_propagator;
boundary_type lb = -pow(FP_Format::BASE,
-static_cast<typename Floating_Point_Expression<FP_Interval_Type, FP_Format>
::boundary_type>(FP_Format::MANTISSA_BITS));
error_propagator.build(i_constraint(GREATER_OR_EQUAL, lb),
i_constraint(LESS_OR_EQUAL, -lb));
// Handle the inhomogeneous term.
const FP_Interval_Type* current_term = &lf.inhomogeneous_term();
assert(current_term->is_bounded());
FP_Interval_Type
current_multiplier(std::max(std::abs(current_term->lower()),
std::abs(current_term->upper())));
FP_Linear_Form current_result_term(current_multiplier);
current_result_term *= error_propagator;
result = FP_Linear_Form(current_result_term);
// Handle the other terms.
dimension_type dimension = lf.space_dimension();
for (dimension_type i = 0; i < dimension; ++i) {
current_term = &lf.coefficient(Variable(i));
assert(current_term->is_bounded());
current_multiplier
= FP_Interval_Type(std::max(std::abs(current_term->lower()),
std::abs(current_term->upper())));
current_result_term = FP_Linear_Form(Variable(i));
current_result_term *= current_multiplier;
current_result_term *= error_propagator;
result += current_result_term;
}
return;
}
|
static |
Absolute error.
Represents the interval
where
is the smallest non-zero positive number in the less precise floating point format between the analyzer format and the analyzed format.
Definition at line 127 of file Floating_Point_Expression.defs.hh.