PPL  1.2
Checked_Number.cc
Go to the documentation of this file.
1 /* Checked_Number class implementation.
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 #include "ppl-config.h"
25 #include "Checked_Number_defs.hh"
26 
27 namespace Parma_Polyhedra_Library {
28 
29 void
31  switch (r - V_UNREPRESENTABLE) {
32  case V_EMPTY:
33  throw std::domain_error("Exact result is not comparable to computable one.");
34  case V_EQ:
35  throw std::logic_error("Exact result is equal to computed one.");
36  case V_LT:
37  throw std::logic_error("Exact result is less than computed one.");
38  case V_LE:
39  throw std::logic_error("Exact result is less than or equal to "
40  "computed one.");
41  case V_GT:
42  throw std::logic_error("Exact result is greater than computed one.");
43  case V_GE:
44  throw std::logic_error("Exact result is greater than or equal to "
45  "computed one.");
46  case V_NE:
47  throw std::logic_error("Exact result is less than or greater than "
48  "computed one.");
49  case V_LGE:
50  throw std::logic_error("Exact result is less than, greater than or "
51  "equal to computed one.");
53  throw std::overflow_error("Minus infinity.");
55  case V_LT_INF:
56  throw std::overflow_error("Negative overflow.");
58  throw std::overflow_error("Unknown result due to intermediate negative overflow.");
59  case V_EQ_PLUS_INFINITY:
60  throw std::overflow_error("Plus infinity.");
61  case V_LT_PLUS_INFINITY:
62  case V_GT_SUP:
63  throw std::overflow_error("Positive overflow.");
65  throw std::overflow_error("Unknown result due to intermediate positive overflow.");
66  case V_NAN:
67  throw std::domain_error("Not-a-Number.");
68  case V_CVT_STR_UNK:
69  throw std::domain_error("Invalid numeric string.");
70  case V_DIV_ZERO:
71  throw std::domain_error("Division by zero.");
72  case V_INF_ADD_INF:
73  throw std::domain_error("Infinities addition.");
74  case V_INF_DIV_INF:
75  throw std::domain_error("Infinities division.");
76  case V_INF_MOD:
77  throw std::domain_error("Remainder of division of infinity.");
78  case V_INF_MUL_ZERO:
79  throw std::domain_error("Multiplication of infinity and zero.");
80  case V_INF_SUB_INF:
81  throw std::domain_error("Subtraction of infinities.");
82  case V_MOD_ZERO:
83  throw std::domain_error("Remainder of division by zero.");
84  case V_SQRT_NEG:
85  throw std::domain_error("Square root of negative number.");
86  default:
87  throw std::logic_error("Unexpected result.");
88  }
89 }
90 
91 } // namespace Parma_Polyhedra_Library
92 
A positive integer overflow occurred (rounding down).
Definition: Result_defs.hh:108
The computed result is exact.
Definition: Result_defs.hh:81
Taking the square root of a negative number.
Definition: Result_defs.hh:150
void throw_result_exception(Result r)
Unknown result due to intermediate positive overflow.
Definition: Result_defs.hh:156
A positive integer overflow occurred (rounding up).
Definition: Result_defs.hh:111
Computing a remainder modulo zero.
Definition: Result_defs.hh:147
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Not a number result.
Definition: Result_defs.hh:123
Taking the modulus of an infinity.
Definition: Result_defs.hh:138
The computed result is inexact and rounded down.
Definition: Result_defs.hh:87
The exact result is not comparable.
Definition: Result_defs.hh:78
Unknown result due to intermediate negative overflow.
Definition: Result_defs.hh:153
The computed result is not representable.
Definition: Result_defs.hh:159
The computed result is inexact.
Definition: Result_defs.hh:90
Converting from unknown string.
Definition: Result_defs.hh:126
The computed result may be inexact and rounded up.
Definition: Result_defs.hh:93
The entire library is confined to this namespace.
Definition: version.hh:61
Adding two infinities having opposite signs.
Definition: Result_defs.hh:132
The computed result may be inexact and rounded down.
Definition: Result_defs.hh:96
Subtracting two infinities having the same sign.
Definition: Result_defs.hh:144
A negative integer overflow occurred (rounding down).
Definition: Result_defs.hh:114
The computed result is inexact and rounded up.
Definition: Result_defs.hh:84
The computed result may be inexact.
Definition: Result_defs.hh:99
Multiplying an infinity by zero.
Definition: Result_defs.hh:141
A negative integer overflow occurred (rounding up).
Definition: Result_defs.hh:105