1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* Declaration of Rounding_Dir and related functions.
Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com)
This file is part of the Parma Polyhedra Library (PPL).
The PPL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The PPL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
For the most up-to-date information see the Parma Polyhedra Library
site: http://www.cs.unipr.it/ppl/ . */
#ifndef PPL_Rounding_defs_hh
#define PPL_Rounding_defs_hh 1
#include "Result.defs.hh"
#include "fpu.defs.hh"
namespace Parma_Polyhedra_Library {
//! Rounding directions for arithmetic computations.
/*! \ingroup PPL_CXX_interface */
enum Rounding_Dir {
/*! \hideinitializer
Round toward \f$-\infty\f$.
*/
ROUND_DOWN = 0,
/*! \hideinitializer
Round toward \f$+\infty\f$.
*/
ROUND_UP = 1,
/*! \hideinitializer
Rounding is delegated to lower level. Result info is evaluated lazily.
*/
ROUND_IGNORE = 6,
ROUND_NATIVE = ROUND_IGNORE,
/*! \hideinitializer
Rounding is not needed: client code must ensure that the operation
result is exact and representable in the destination type.
Result info is evaluated lazily.
*/
ROUND_NOT_NEEDED = 7,
ROUND_DIRECT = ROUND_UP,
ROUND_INVERSE = ROUND_DOWN,
ROUND_DIR_MASK = 7,
/*! \hideinitializer
The client code is willing to pay an extra price to know the exact
relation beetwen the exact result and the computed one.
*/
ROUND_STRICT_RELATION = 8,
ROUND_CHECK = ROUND_DIRECT | ROUND_STRICT_RELATION
};
/*! \brief
Returns the inverse rounding mode of \p dir,
<CODE>ROUND_IGNORE</CODE> being the inverse of itself.
*/
Rounding_Dir inverse(Rounding_Dir dir);
Rounding_Dir round_dir(Rounding_Dir dir);
bool round_down(Rounding_Dir dir);
bool round_up(Rounding_Dir dir);
bool round_ignore(Rounding_Dir dir);
bool round_not_needed(Rounding_Dir dir);
bool round_not_requested(Rounding_Dir dir);
bool round_direct(Rounding_Dir dir);
bool round_inverse(Rounding_Dir dir);
bool round_strict_relation(Rounding_Dir dir);
fpu_rounding_direction_type round_fpu_dir(Rounding_Dir dir);
} // namespace Parma_Polyhedra_Library
#include "Rounding_Dir.inlines.hh"
#endif // !defined(PPL_Float_defs_hh)
|