cprover
Loading...
Searching...
No Matches
boolbv_floatbv_fma.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Michael Tautschnig
6
7\*******************************************************************/
8
10#include <util/floatbv_expr.h>
11
13
14#include "boolbv.h"
15
17{
18 float_utilst float_utils(prop);
19
20 float_utils.set_rounding_mode(convert_bv(expr.rounding_mode()));
21 float_utils.spec = ieee_float_spect(to_floatbv_type(expr.type()));
22
23 bvt multiply_lhs = convert_bv(expr.op_multiply_lhs());
24 bvt multiply_rhs = convert_bv(expr.op_multiply_rhs());
25 bvt addend = convert_bv(expr.op_add());
26
27 return float_utils.fma(multiply_lhs, multiply_rhs, addend);
28}
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
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:40
virtual bvt convert_floatbv_fma(const floatbv_fma_exprt &)
typet & type()
Return the type of the expression.
Definition expr.h:85
void set_rounding_mode(const bvt &)
bvt fma(const bvt &multiply_lhs, const bvt &multiply_rhs, const bvt &addend)
Fused multiply-add: round(multiply_lhs * multiply_rhs + addend) with a single rounding step.
ieee_float_spect spec
Definition float_utils.h:94
Fused multiply-add expression: round(op0 * op1 + op2) with a single rounding.
exprt & op_multiply_lhs()
exprt & op_multiply_rhs()
exprt & rounding_mode()
API to expression classes for floating-point arithmetic.
std::vector< literalt > bvt
Definition literal.h:201