CBMC
mathematical_types.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Mathematical types
4 
5 Author: Daniel Kroening, kroening@kroening.com
6  Maria Svorenova, maria.svorenova@diffblue.com
7 
8 \*******************************************************************/
9 
12 
13 #include "mathematical_types.h"
14 
15 #include "std_expr.h"
16 
19 bool is_number(const typet &type)
20 {
21  const irep_idt &id = type.id();
22  return id == ID_rational || id == ID_real || id == ID_integer ||
23  id == ID_natural || id == ID_complex || id == ID_unsignedbv ||
24  id == ID_signedbv || id == ID_floatbv || id == ID_fixedbv;
25 }
26 
28 {
29  return constant_exprt{ID_0, *this};
30 }
31 
33 {
34  return constant_exprt{ID_1, *this};
35 }
36 
38 {
39  return constant_exprt{ID_0, *this};
40 }
41 
43 {
44  return constant_exprt{ID_1, *this};
45 }
46 
48 {
49  return constant_exprt{ID_0, *this};
50 }
51 
53 {
54  return constant_exprt{ID_1, *this};
55 }
56 
58 {
59  return constant_exprt{ID_0, *this};
60 }
61 
63 {
64  return constant_exprt{ID_1, *this};
65 }
A constant literal expression.
Definition: std_expr.h:3000
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
constant_exprt one_expr() const
constant_exprt zero_expr() const
const irep_idt & id() const
Definition: irep.h:388
constant_exprt zero_expr() const
constant_exprt one_expr() const
constant_exprt zero_expr() const
constant_exprt one_expr() const
constant_exprt zero_expr() const
constant_exprt one_expr() const
The type of an expression, extends irept.
Definition: type.h:29
bool is_number(const typet &type)
Returns true if the type is a rational, real, integer, natural, complex, unsignedbv,...
Mathematical types.
API to expression classes.