-
Notifications
You must be signed in to change notification settings - Fork 291
Add fp.isSubnormal, fp.isNegative, fp.isPositive to SMT2 parser #8889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| CORE | ||
| fp-predicates1.smt2 | ||
|
|
||
| activate-multi-line-match | ||
| ^EXIT=0$ | ||
| ^SIGNAL=0$ | ||
| ^sat$[\s\S]*?^unsat$[\s\S]*?^unsat$[\s\S]*?^unsat$ | ||
| -- | ||
| Test fp.isSubnormal, fp.isNegative, fp.isPositive predicates. | ||
| The leading sat covers the under-approximation cases: each | ||
| predicate must hold on a witness. The three trailing unsat | ||
| results from check-sat-assuming cover over-approximation: -0 | ||
| must not be positive, +0 must not be negative, and 1.0 must not | ||
| be subnormal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| ; Test fp.isSubnormal, fp.isNegative, fp.isPositive predicates. | ||
|
|
||
| (set-logic QF_FP) | ||
|
|
||
| ; A subnormal Float32 exists, and at least one concrete subnormal | ||
| ; bit-pattern is classified as subnormal (and not zero / not normal). | ||
| (declare-const s (_ FloatingPoint 8 24)) | ||
| (assert (fp.isSubnormal s)) | ||
| (assert (not (fp.isZero s))) | ||
|
|
||
| ; Smallest positive Float32 subnormal: exponent = 0, mantissa = 0...01 | ||
| (assert (fp.isSubnormal | ||
| (fp #b0 #b00000000 #b00000000000000000000001))) | ||
| (assert (not (fp.isNormal | ||
| (fp #b0 #b00000000 #b00000000000000000000001)))) | ||
|
|
||
| ; A negative normal value exists | ||
| (declare-const n (_ FloatingPoint 8 24)) | ||
| (assert (fp.isNegative n)) | ||
| (assert (fp.isNormal n)) | ||
|
tautschnig marked this conversation as resolved.
|
||
|
|
||
| ; A positive value exists | ||
| (declare-const p (_ FloatingPoint 8 24)) | ||
| (assert (fp.isPositive p)) | ||
|
|
||
| ; NaN is neither negative nor positive | ||
| (assert (not (fp.isNegative (_ NaN 8 24)))) | ||
| (assert (not (fp.isPositive (_ NaN 8 24)))) | ||
|
|
||
| ; Negative zero is negative, positive zero is positive | ||
| (assert (fp.isNegative (fp #b1 #b00000000 #b00000000000000000000000))) | ||
| (assert (not (fp.isNegative (fp #b0 #b00000000 #b00000000000000000000000)))) | ||
| (assert (fp.isPositive (fp #b0 #b00000000 #b00000000000000000000000))) | ||
| (assert (not (fp.isPositive (fp #b1 #b00000000 #b00000000000000000000000)))) | ||
|
|
||
| (check-sat) | ||
|
tautschnig marked this conversation as resolved.
|
||
|
|
||
| ; Negative coverage: each of these would be `sat` if the corresponding | ||
| ; predicate over-approximated. Expect `unsat` instead. | ||
| (check-sat-assuming | ||
| ((fp.isPositive (fp #b1 #b00000000 #b00000000000000000000000)))) ; -0 | ||
| (check-sat-assuming | ||
| ((fp.isNegative (fp #b0 #b00000000 #b00000000000000000000000)))) ; +0 | ||
| (check-sat-assuming | ||
| ((fp.isSubnormal (fp #b0 #b01111111 #b00000000000000000000000)))) ; 1.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.