Skip to content

Commit fc165c1

Browse files
authored
Merge pull request #6305 from diffblue/smt2_float_sorts
SMT-LIB2: parse FloatX sorts
2 parents 9dddf58 + e926415 commit fc165c1

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
basic-fp3.smt2
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\(define-fun a \(\) \(_ FloatingPoint 5 11\) .*\)
7+
\(define-fun b \(\) \(_ FloatingPoint 8 24\) .*\)
8+
\(define-fun c \(\) \(_ FloatingPoint 11 53\) .*\)
9+
\(define-fun d \(\) \(_ FloatingPoint 15 113\) .*\)
10+
--
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(set-logic FP)
2+
3+
(declare-fun a () Float16)
4+
(declare-fun b () Float32)
5+
(declare-fun c () Float64)
6+
(declare-fun d () Float128)
7+
8+
(check-sat)
9+
(get-model)

src/solvers/smt2/smt2_parser.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,19 @@ void smt2_parsert::setup_sorts()
14051405
sorts["Int"] = [] { return integer_typet(); };
14061406
sorts["Real"] = [] { return real_typet(); };
14071407

1408+
sorts["Float16"] = [] {
1409+
return ieee_float_spect::half_precision().to_type();
1410+
};
1411+
sorts["Float32"] = [] {
1412+
return ieee_float_spect::single_precision().to_type();
1413+
};
1414+
sorts["Float64"] = [] {
1415+
return ieee_float_spect::double_precision().to_type();
1416+
};
1417+
sorts["Float128"] = [] {
1418+
return ieee_float_spect::quadruple_precision().to_type();
1419+
};
1420+
14081421
sorts["BitVec"] = [this] {
14091422
if(next_token() != smt2_tokenizert::NUMERAL)
14101423
throw error("expected numeral as bit-width");

0 commit comments

Comments
 (0)