@@ -761,12 +761,13 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
761
761
else if (old_type.id () == ID_floatbv) // float -> signed
762
762
{
763
763
// Note that the fractional part is truncated!
764
- ieee_floatt upper (to_floatbv_type (old_type));
764
+ auto rm = ieee_floatt::rounding_modet::ROUND_TO_EVEN;
765
+ ieee_floatt upper (to_floatbv_type (old_type), rm);
765
766
upper.from_integer (power (2 , new_width - 1 ));
766
767
const binary_relation_exprt no_overflow_upper (
767
768
op, ID_lt, upper.to_expr ());
768
769
769
- ieee_floatt lower (to_floatbv_type (old_type));
770
+ ieee_floatt lower (to_floatbv_type (old_type), rm );
770
771
lower.from_integer (-power (2 , new_width - 1 ) - 1 );
771
772
const binary_relation_exprt no_overflow_lower (
772
773
op, ID_gt, lower.to_expr ());
@@ -844,12 +845,13 @@ void goto_check_ct::conversion_check(const exprt &expr, const guardt &guard)
844
845
else if (old_type.id () == ID_floatbv) // float -> unsigned
845
846
{
846
847
// Note that the fractional part is truncated!
847
- ieee_floatt upper (to_floatbv_type (old_type));
848
+ auto rm = ieee_floatt::rounding_modet::ROUND_TO_EVEN;
849
+ ieee_floatt upper (to_floatbv_type (old_type), rm);
848
850
upper.from_integer (power (2 , new_width));
849
851
const binary_relation_exprt no_overflow_upper (
850
852
op, ID_lt, upper.to_expr ());
851
853
852
- ieee_floatt lower (to_floatbv_type (old_type));
854
+ ieee_floatt lower (to_floatbv_type (old_type), rm );
853
855
lower.from_integer (-1 );
854
856
const binary_relation_exprt no_overflow_lower (
855
857
op, ID_gt, lower.to_expr ());
@@ -1295,8 +1297,8 @@ void goto_check_ct::nan_check(const exprt &expr, const guardt &guard)
1295
1297
// -inf + +inf = NaN and +inf + -inf = NaN,
1296
1298
// i.e., signs differ
1297
1299
ieee_float_spect spec = ieee_float_spect (to_floatbv_type (plus_expr.type ()));
1298
- exprt plus_inf = ieee_floatt ::plus_infinity (spec).to_expr ();
1299
- exprt minus_inf = ieee_floatt ::minus_infinity (spec).to_expr ();
1300
+ exprt plus_inf = ieee_float_valuet ::plus_infinity (spec).to_expr ();
1301
+ exprt minus_inf = ieee_float_valuet ::minus_infinity (spec).to_expr ();
1300
1302
1301
1303
isnan = or_exprt (
1302
1304
and_exprt (
@@ -1315,8 +1317,8 @@ void goto_check_ct::nan_check(const exprt &expr, const guardt &guard)
1315
1317
1316
1318
ieee_float_spect spec =
1317
1319
ieee_float_spect (to_floatbv_type (minus_expr.type ()));
1318
- exprt plus_inf = ieee_floatt ::plus_infinity (spec).to_expr ();
1319
- exprt minus_inf = ieee_floatt ::minus_infinity (spec).to_expr ();
1320
+ exprt plus_inf = ieee_float_valuet ::plus_infinity (spec).to_expr ();
1321
+ exprt minus_inf = ieee_float_valuet ::minus_infinity (spec).to_expr ();
1320
1322
1321
1323
isnan = or_exprt (
1322
1324
and_exprt (
0 commit comments