Go to the documentation of this file.
75 if(type.
id()==ID_floatbv)
78 value.set_sign(
false);
82 else if(type.
id()==ID_signedbv ||
83 type.
id()==ID_unsignedbv)
117 if(type.
id()==ID_floatbv)
123 else if(type.
id()==ID_signedbv ||
124 type.
id()==ID_unsignedbv)
148 if(dest_type==src_type)
151 const exprt &casted_expr = expr.
op();
158 if(casted_expr.
id()==ID_floatbv_div ||
159 casted_expr.
id()==ID_floatbv_mult ||
160 casted_expr.
id()==ID_floatbv_plus ||
161 casted_expr.
id()==ID_floatbv_minus)
163 if(casted_expr.
operands().size()==3 &&
164 casted_expr.
op0().
id()==ID_typecast &&
165 casted_expr.
op1().
id()==ID_typecast &&
168 casted_expr.
op0().
type()==dest_type &&
169 casted_expr.
op1().
type()==dest_type)
171 exprt result(casted_expr.
id(), floatbv_typecast_expr.type());
175 result.
op2()=rounding_mode;
187 const auto rounding_mode_index = numeric_cast<mp_integer>(rounding_mode);
188 if(rounding_mode_index.has_value())
190 if(src_type.
id()==ID_floatbv)
192 if(dest_type.
id()==ID_floatbv)
197 *rounding_mode_index);
202 else if(dest_type.
id()==ID_signedbv ||
203 dest_type.
id()==ID_unsignedbv)
210 *rounding_mode_index);
216 else if(src_type.
id()==ID_signedbv ||
217 src_type.
id()==ID_unsignedbv)
219 const auto value = numeric_cast<mp_integer>(casted_expr);
220 if(value.has_value())
222 if(dest_type.
id()==ID_floatbv)
227 *rounding_mode_index);
233 else if(src_type.
id() == ID_c_enum_tag)
237 exprt simplified_typecast =
242 new_floatbv_typecast_expr.
op() = simplified_typecast;
255 if(casted_expr.
id()==ID_if)
257 auto const &casted_if_expr =
to_if_expr(casted_expr);
264 auto simplified_if_expr =
simplify_expr(
if_exprt(casted_if_expr.cond(), casted_true_case, casted_false_case, dest_type),
ns);
265 expr = simplified_if_expr;
280 expr.
id() == ID_floatbv_plus || expr.
id() == ID_floatbv_minus ||
281 expr.
id() == ID_floatbv_mult || expr.
id() == ID_floatbv_div);
289 "expression type of operand must match type of expression");
292 "expression type of operand must match type of expression");
303 const auto rounding_mode = numeric_cast<mp_integer>(op2);
304 if(rounding_mode.has_value())
313 if(expr.
id()==ID_floatbv_plus)
315 else if(expr.
id()==ID_floatbv_minus)
317 else if(expr.
id()==ID_floatbv_mult)
319 else if(expr.
id()==ID_floatbv_div)
329 if(expr.
id()==ID_floatbv_div &&
342 expr.
id() == ID_ieee_float_equal || expr.
id() == ID_ieee_float_notequal);
358 if(expr.
id()==ID_ieee_float_notequal)
360 else if(expr.
id()==ID_ieee_float_equal)
368 if(lhs_sorted.
id() == ID_floatbv_plus || lhs_sorted.
id() == ID_floatbv_mult)
371 if(rhs_sorted.
id() == ID_floatbv_plus || rhs_sorted.
id() == ID_floatbv_mult)
374 if(lhs_sorted == rhs_sorted)
379 if(expr.
id()==ID_ieee_float_notequal)
382 else if(expr.
id()==ID_ieee_float_equal)
387 return std::move(isnan);
#define UNREACHABLE
This should be used to mark dead code.
resultt simplify_isnormal(const unary_exprt &)
The type of an expression, extends irept.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
The trinary if-then-else operator.
void change_spec(const ieee_float_spect &dest_spec)
Base class for all expressions.
Generic base class for unary expressions.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
mp_integer to_integer() const
static resultt unchanged(exprt expr)
resultt simplify_node(exprt)
typet & type()
Return the type of the expression.
Semantic type conversion from/to floating-point formats.
resultt simplify_isnan(const unary_exprt &)
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
#define PRECONDITION(CONDITION)
bool ieee_equal(const ieee_floatt &other) const
exprt simplify_expr(exprt src, const namespacet &ns)
const irep_idt & id() const
API to expression classes for floating-point arithmetic.
void from_integer(const mp_integer &i)
rounding_modet rounding_mode
Deprecated expression utility functions.
bool ieee_not_equal(const ieee_floatt &other) const
resultt simplify_sign(const sign_exprt &)
bool is_constant() const
Return whether the expression is a constant.
A base class for relations, i.e., binary predicates whose two operands have the same type.
IEEE floating-point operations These have two data operands (op0 and op1) and one rounding mode (op2)...
bool is_one() const
Return whether the expression is a constant representing 1.
constant_exprt to_expr() const
constant_exprt make_boolean_expr(bool value)
returns true_exprt if given true and false_exprt otherwise
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Semantic type conversion.
resultt simplify_abs(const abs_exprt &)
API to expression classes.
resultt simplify_ieee_float_relation(const binary_relation_exprt &)
resultt simplify_floatbv_typecast(const floatbv_typecast_exprt &)
resultt simplify_floatbv_op(const ieee_float_op_exprt &)
Evaluates to true if the operand is NaN.
bool sort_operands(exprt::operandst &operands)
sort operands of an expression according to ordering defined by operator<
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
resultt simplify_isinf(const unary_exprt &)