@@ -55,8 +55,8 @@ exprt get_magnitude(const exprt &src, const ieee_float_spect &spec)
55
55
exprt get_significand (
56
56
const exprt &src, const ieee_float_spect &spec, const typet &type)
57
57
{
58
- assert (type.id ()==ID_unsignedbv);
59
- assert (to_unsignedbv_type (type).get_width ()>spec.f );
58
+ PRECONDITION (type.id ()==ID_unsignedbv);
59
+ PRECONDITION (to_unsignedbv_type (type).get_width ()>spec.f );
60
60
typecast_exprt magnitude (get_magnitude (src, spec), type);
61
61
exprt exponent=get_exponent (src, spec);
62
62
equal_exprt all_zeros (exponent, from_integer (0 , exponent.type ()));
@@ -71,14 +71,11 @@ exprt constant_float(const double f, const ieee_float_spect &float_spec)
71
71
{
72
72
ieee_floatt fl (float_spec);
73
73
if (float_spec==ieee_float_spect::single_precision ())
74
- {
75
74
fl.from_float (f);
76
- }
77
- else
78
- {
79
- assert (float_spec==ieee_float_spect::double_precision ());
75
+ else if (float_spec==ieee_float_spect::double_precision ())
80
76
fl.from_double (f);
81
- }
77
+ else
78
+ UNREACHABLE;
82
79
return fl.to_expr ();
83
80
}
84
81
@@ -99,8 +96,8 @@ exprt round_expr_to_zero(const exprt &f)
99
96
// / \return An expression representing floating point multiplication.
100
97
exprt floatbv_mult (const exprt &f, const exprt &g)
101
98
{
99
+ PRECONDITION (f.type ()==g.type ());
102
100
ieee_floatt::rounding_modet rounding=ieee_floatt::ROUND_TO_EVEN;
103
- assert (f.type ()==g.type ());
104
101
exprt mult (ID_floatbv_mult, f.type ());
105
102
mult.copy_to_operands (f);
106
103
mult.copy_to_operands (g);
@@ -209,9 +206,9 @@ string_exprt string_constraint_generatort::add_axioms_from_float(
209
206
string_exprt string_constraint_generatort::add_axioms_for_fractional_part (
210
207
const exprt &i, size_t max_size, const refined_string_typet &ref_type)
211
208
{
212
- string_exprt res= fresh_string (ref_type );
209
+ PRECONDITION (i. type (). id ()==ID_signedbv );
213
210
const typet &type=i.type ();
214
- assert (type. id ()==ID_signedbv );
211
+ string_exprt res= fresh_string (ref_type );
215
212
exprt ten=from_integer (10 , type);
216
213
const typet &char_type=ref_type.get_char_type ();
217
214
const typet &index_type=ref_type.get_index_type ();
0 commit comments