CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boolbv_floatbv_mod_rem.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
12
14
16{
17 // Note that the expressions do not have rounding modes
18 // but float_utils requires one.
19
21
23 float_utils.set_rounding_mode(rm);
24
26
27 bvt lhs_as_bv = convert_bv(expr.lhs());
28 bvt rhs_as_bv = convert_bv(expr.rhs());
29
30 // float_utilst::rem implements lhs-(lhs/rhs)*rhs, which matches
31 // neither fmod() nor IEEE
32 return float_utils.rem(lhs_as_bv, rhs_as_bv);
33}
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
A base class for binary expressions.
Definition std_expr.h:638
exprt & lhs()
Definition std_expr.h:668
exprt & rhs()
Definition std_expr.h:678
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
bv_utilst bv_utils
Definition boolbv.h:118
virtual bvt convert_floatbv_mod_rem(const binary_exprt &)
static bvt build_constant(const mp_integer &i, std::size_t width)
Definition bv_utils.cpp:14
typet & type()
Return the type of the expression.
Definition expr.h:84
std::vector< literalt > bvt
Definition literal.h:201