-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add float support to constant propagator domain
- Loading branch information
1 parent
9a8ae03
commit 0136d94
Showing
6 changed files
with
71 additions
and
22 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
regression/goto-analyzer/constant_propagation_floating_point_div/main.c
This file contains 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,9 @@ | ||
#include <assert.h> | ||
|
||
#define ROUND_F(x) ((int)((x)+0.5f)) | ||
int eight = ROUND_F(100.0f/12.0f); | ||
|
||
int main() | ||
{ | ||
assert(eight == 8); | ||
} |
8 changes: 8 additions & 0 deletions
8
regression/goto-analyzer/constant_propagation_floating_point_div/test.desc
This file contains 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,8 @@ | ||
CORE | ||
main.c | ||
--constants --verify | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.assertion.1\] file main.c line 8 function main, assertion eight == 8: Success$ | ||
-- | ||
^warning: ignoring |
12 changes: 12 additions & 0 deletions
12
regression/goto-analyzer/constant_propagation_rounding_mode/main.c
This file contains 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,12 @@ | ||
#include <assert.h> | ||
|
||
int main(void) | ||
{ | ||
__CPROVER_rounding_mode = 0; | ||
float rounded_up = 1.0f/10.0f; | ||
__CPROVER_rounding_mode = 1; | ||
float rounded_down = 1.0f/10.0f; | ||
assert(rounded_up - 0.1f >= 0); | ||
assert(rounded_down - 0.1f < 0); | ||
return 0; | ||
} |
10 changes: 10 additions & 0 deletions
10
regression/goto-analyzer/constant_propagation_rounding_mode/test.desc
This file contains 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,10 @@ | ||
|
||
CORE | ||
main.c | ||
--constants --verify | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^\[main.assertion.1\] file main.c line 9 function main, assertion rounded_up - 0.1f >= 0: Success | ||
^\[main.assertion.2\] file main.c line 10 function main, assertion rounded_down - 0.1f < 0: Success | ||
-- | ||
^warning: ignoring |
This file contains 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
This file contains 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