Skip to content

Commit 28a1ad0

Browse files
committed
doc: Add examples for ae.float primitives
1 parent 64b8ba6 commit 28a1ad0

File tree

1 file changed

+26
-6
lines changed
  • docs/sphinx_docs/SMT-LIB_language

1 file changed

+26
-6
lines changed

docs/sphinx_docs/SMT-LIB_language/index.md

+26-6
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ the FloatingPoint SMT-LIB theory.
5353
((_ ae.round prec exp) RoundingMode Real Real)
5454
```
5555

56-
*Note*: While Alt-Ergo has built-in support for **computing** with `ae.round`
57-
on known arguments, reasoning capabilities involving `ae.round` on non-constant
58-
arguments are disabled by default and currently requires to use the flag
59-
`--enable-theories fpa`.
60-
6156
`prec` defines the number of bits in the significand, including the hidden bit,
6257
and is equivalent to the `sb` parameter of the `(_ FloatingPoint eb sb)` sort
6358
in the FloatingPoint SMT-LIB theory.
@@ -70,7 +65,7 @@ of the `(_ FloatingPoint eb sb)` sort as `exp = 2^(eb - 1) + sb - 3`.
7065

7166
The result of `(_ ae.round prec exp)` is always of the form `(-1)^s * c * 2^q`
7267
where `s` is a sign (`0` or `1`), `c` is an integer with at most `prec - 1`
73-
binary digits (i.e. `0 <= c < 2^(prec - 1)`) and `q >= exp` is an integer.
68+
binary digits (i.e. `0 <= c < 2^(prec - 1)`) and `q >= -exp` is an integer.
7469

7570
The following function symbols are provided as short synonyms for common
7671
floating point representations:
@@ -79,3 +74,28 @@ floating point representations:
7974
- `ae.float32` is a synonym for `(_ ae.round 24 149)`
8075
- `ae.float64` is a synonym for `(_ ae.round 53 1074)`
8176
- `ae.float128` is a synonym for `(_ ae.round 113 16494)`
77+
78+
### Examples
79+
80+
Input:
81+
82+
```smt-lib
83+
(set-option :produce-models true)
84+
(set-logic ALL)
85+
(declare-const |0.3f32| Real)
86+
(assert (= (ae.float32 RNE 0.3) |0.3f32|))
87+
(declare-const |0.3f16| Real)
88+
(assert (= (ae.float16 RNE 0.3) |0.3f16|))
89+
(check-sat)
90+
(get-model)
91+
```
92+
93+
Output:
94+
95+
```smt-lib
96+
unknown
97+
(
98+
(define-fun |0.3f32| () Real (/ 5033165 16777216))
99+
(define-fun |0.3f16| () Real (/ 1229 4096))
100+
)
101+
```

0 commit comments

Comments
 (0)