PPL  1.2
Floating_Point_Expression_defs.hh
Go to the documentation of this file.
1 /* Declarations for the Floating_Point_Expression class and its constituents.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Floating_Point_Expression_defs_hh
25 #define PPL_Floating_Point_Expression_defs_hh 1
26 
28 #include "globals_defs.hh"
29 #include "Linear_Form_types.hh"
30 #include "Box_types.hh"
31 #include <cmath>
32 #include <map>
33 
34 namespace Parma_Polyhedra_Library {
35 
54 template <typename FP_Interval_Type, typename FP_Format>
56 
57 public:
58 
61 
63 
71 
73 
77  typedef std::map<dimension_type, FP_Linear_Form>
79 
81  typedef typename FP_Interval_Type::boundary_type boundary_type;
82 
84  typedef typename FP_Interval_Type::info_type info_type;
85 
88 
90 
114  virtual bool linearize(const FP_Interval_Abstract_Store& int_store,
115  const FP_Linear_Form_Abstract_Store& lf_store,
116  FP_Linear_Form& result) const = 0;
117 
126  static FP_Interval_Type absolute_error;
127 
128  // FIXME: this may not be the best place for them.
136  static bool overflows(const FP_Linear_Form& lf);
137 
163  static void relative_error(const FP_Linear_Form& lf,
164  FP_Linear_Form& result);
165 
183  static void intervalize(const FP_Linear_Form& lf,
184  const FP_Interval_Abstract_Store& store,
185  FP_Interval_Type& result);
186 
187 private:
188 
198  static FP_Interval_Type compute_absolute_error();
199 
200 }; // class Floating_Point_Expression
201 
202 
203 template <typename FP_Interval_Type, typename FP_Format>
205  ::absolute_error = compute_absolute_error();
206 
207 } // namespace Parma_Polyhedra_Library
208 
211 
212 #endif // !defined(PPL_Floating_Point_Expression_defs_hh)
FP_Interval_Type::boundary_type boundary_type
The floating point format used by the analyzer.
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.
const FP_Interval_Type & compute_absolute_error(const Floating_Point_Format analyzed_format)
static FP_Interval_Type compute_absolute_error()
Computes the absolute error.
static void relative_error(const FP_Linear_Form &lf, FP_Linear_Form &result)
Computes the relative error of a given linear form.
A linear form with interval coefficients.
A not necessarily closed, iso-oriented hyperrectangle.
Definition: Box_defs.hh:299
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 a...
Linear_Form< FP_Interval_Type > FP_Linear_Form
Alias for a linear form with template argument FP_Interval_Type.
static bool overflows(const FP_Linear_Form &lf)
Verifies if a given linear form overflows.
The entire library is confined to this namespace.
Definition: version.hh:61
FP_Interval_Type::info_type info_type
The interval policy used by FP_Interval_Type.
Box< FP_Interval_Type > FP_Interval_Abstract_Store
Alias for a map that associates a variable index to an interval.
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.