PPL  0.12.1
Floating_Point_Expression.defs.hh
Go to the documentation of this file.
00001 /* Declarations for the Floating_Point_Expression class and its constituents.
00002    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
00003    Copyright (C) 2010-2012 BUGSENG srl (http://bugseng.com)
00004 
00005 This file is part of the Parma Polyhedra Library (PPL).
00006 
00007 The PPL is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 The PPL is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software Foundation,
00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
00020 
00021 For the most up-to-date information see the Parma Polyhedra Library
00022 site: http://bugseng.com/products/ppl/ . */
00023 
00024 #ifndef PPL_Floating_Point_Expression_defs_hh
00025 #define PPL_Floating_Point_Expression_defs_hh 1
00026 
00027 #include "globals.defs.hh"
00028 #include "Floating_Point_Expression.types.hh"
00029 #include "Linear_Form.types.hh"
00030 #include "Box.types.hh"
00031 #include <cmath>
00032 #include <map>
00033 
00034 namespace Parma_Polyhedra_Library {
00035 
00055 template <typename FP_Interval_Type, typename FP_Format>
00056 class Floating_Point_Expression {
00057 
00058 public:
00059 
00061   typedef Linear_Form<FP_Interval_Type> FP_Linear_Form;
00062 
00064 
00071   typedef Box<FP_Interval_Type> FP_Interval_Abstract_Store;
00072 
00074 
00078   typedef std::map<dimension_type, FP_Linear_Form>
00079           FP_Linear_Form_Abstract_Store;
00080 
00082   typedef typename FP_Interval_Type::boundary_type boundary_type;
00083 
00085   typedef typename FP_Interval_Type::info_type info_type;
00086 
00088   virtual ~Floating_Point_Expression();
00089 
00091 
00115   virtual bool linearize(const FP_Interval_Abstract_Store& int_store,
00116                          const FP_Linear_Form_Abstract_Store& lf_store,
00117                          FP_Linear_Form& result) const = 0;
00118 
00127   static FP_Interval_Type absolute_error;
00128 
00129   // FIXME: this may not be the best place for them.
00137   static bool overflows(const FP_Linear_Form& lf);
00138 
00164   static void relative_error(const FP_Linear_Form& lf,
00165                              FP_Linear_Form& result);
00166 
00184   static void intervalize(const FP_Linear_Form& lf,
00185                           const FP_Interval_Abstract_Store& store,
00186                           FP_Interval_Type& result);
00187 
00188 private:
00189 
00199   static FP_Interval_Type compute_absolute_error();
00200 
00201 }; // class Floating_Point_Expression
00202 
00203 
00204 template <typename FP_Interval_Type, typename FP_Format>
00205 FP_Interval_Type Floating_Point_Expression<FP_Interval_Type, FP_Format>
00206   ::absolute_error = compute_absolute_error();
00207 
00208 } // namespace Parma_Polyhedra_Library
00209 
00210 #include "Floating_Point_Expression.inlines.hh"
00211 #include "Floating_Point_Expression.templates.hh"
00212 
00213 #endif // !defined(PPL_Floating_Point_Expression_defs_hh)