CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boolbv_ieee_float_rel.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "boolbv.h"
10
11#include "boolbv_type.h"
12
14
16
18{
19 const exprt::operandst &operands=expr.operands();
20 const irep_idt &rel=expr.id();
21
22 if(operands.size()==2)
23 {
24 const exprt &op0=expr.op0();
25 const exprt &op1=expr.op1();
26
29
30 const bvt &bv0=convert_bv(op0);
31 const bvt &bv1=convert_bv(op1);
32
33 if(bv0.size()==bv1.size() && !bv0.empty() &&
35 {
37
38 if(rel==ID_ieee_float_equal)
39 return float_utils.relation(bv0, float_utilst::relt::EQ, bv1);
40 else if(rel==ID_ieee_float_notequal)
41 return !float_utils.relation(bv0, float_utilst::relt::EQ, bv1);
42 else
43 return SUB::convert_rest(expr);
44 }
45 }
46
47 return SUB::convert_rest(expr);
48}
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
bvtypet get_bvtype(const typet &type)
bvtypet
Definition boolbv_type.h:17
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
exprt & op0()
Definition expr.h:133
exprt & op1()
Definition expr.h:136
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition std_expr.h:762
virtual const bvt & convert_bv(const exprt &expr, const std::optional< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
Definition boolbv.cpp:39
virtual literalt convert_ieee_float_rel(const binary_relation_exprt &)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Base class for all expressions.
Definition expr.h:56
std::vector< exprt > operandst
Definition expr.h:58
typet & type()
Return the type of the expression.
Definition expr.h:84
operandst & operands()
Definition expr.h:94
const irep_idt & id() const
Definition irep.h:388
virtual literalt convert_rest(const exprt &expr)
std::vector< literalt > bvt
Definition literal.h:201