ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
smt_fp_rounding_utils.h
Go to the documentation of this file.
1#pragma once
2
3#include "irep2/irep2_expr.h"
5
7{
8// Shared rounding-mode predicates used by both smt_conv.cpp and
9// smt_fp_conv.cpp. Keeping these in one place avoids semantic drift between
10// interval enclosure paths and IEEE754 post-processing paths.
11inline bool is_nearest_rounding_mode(const expr2tc &rounding_mode)
12{
13 if (is_nil_expr(rounding_mode))
14 return false;
15 if (!is_constant_int2t(rounding_mode))
16 return false;
17 return to_constant_int2t(rounding_mode).value ==
19}
20
21inline bool is_round_to_plus_inf(const expr2tc &rounding_mode)
22{
23 if (is_nil_expr(rounding_mode))
24 return false;
25 if (!is_constant_int2t(rounding_mode))
26 return false;
27 return to_constant_int2t(rounding_mode).value ==
29}
30
31inline bool is_round_to_minus_inf(const expr2tc &rounding_mode)
32{
33 if (is_nil_expr(rounding_mode))
34 return false;
35 if (!is_constant_int2t(rounding_mode))
36 return false;
37 return to_constant_int2t(rounding_mode).value ==
39}
40
41inline bool is_round_to_zero(const expr2tc &rounding_mode)
42{
43 if (is_nil_expr(rounding_mode))
44 return false;
45 if (!is_constant_int2t(rounding_mode))
46 return false;
47 return to_constant_int2t(rounding_mode).value ==
49}
50
51inline bool is_round_to_away(const expr2tc &rounding_mode)
52{
53 if (is_nil_expr(rounding_mode))
54 return false;
55 if (!is_constant_int2t(rounding_mode))
56 return false;
57 return to_constant_int2t(rounding_mode).value ==
59}
60} // namespace smt_fp_rounding_utils
Definition bigint.hh:58
@ ROUND_TO_ZERO
Definition ieee_float.h:83
@ ROUND_TO_PLUS_INF
Definition ieee_float.h:81
@ ROUND_TO_AWAY
Definition ieee_float.h:80
@ ROUND_TO_EVEN
Definition ieee_float.h:79
@ ROUND_TO_MINUS_INF
Definition ieee_float.h:82
bool is_nil_expr(const expr2tc &exp)
Definition irep2.h:916
irep_container< expr2t > expr2tc
Definition irep2.h:431
Definition smt_fp_rounding_utils.h:7
bool is_round_to_minus_inf(const expr2tc &rounding_mode)
Definition smt_fp_rounding_utils.h:31
bool is_round_to_plus_inf(const expr2tc &rounding_mode)
Definition smt_fp_rounding_utils.h:21
bool is_round_to_away(const expr2tc &rounding_mode)
Definition smt_fp_rounding_utils.h:51
bool is_round_to_zero(const expr2tc &rounding_mode)
Definition smt_fp_rounding_utils.h:41
bool is_nearest_rounding_mode(const expr2tc &rounding_mode)
Definition smt_fp_rounding_utils.h:11