source:
CIVL/examples/analysis/abs.c@
75982de
| Last change on this file since 75982de was 9570bc1, checked in by , 11 years ago | |
|---|---|
|
|
| File size: 406 bytes | |
| Rev | Line | |
|---|---|---|
| [b1b88d8] | 1 | #include <stdlib.h> |
| [9570bc1] | 2 | #include <civlc.cvh> |
| [b1b88d8] | 3 | |
| [9570bc1] | 4 | $input int i; |
| 5 | $input int x; | |
| 6 | $input int y; | |
| 7 | $input int z; | |
| 8 | $assume(x<0); | |
| 9 | $assume(y>0); | |
| [b1b88d8] | 10 | void main(){ |
| 11 | int a = 9; | |
| 12 | ||
| [9570bc1] | 13 | a=abs(0); // 0 |
| 14 | a=abs(x); // - | |
| 15 | a=abs(y); // + | |
| 16 | a=abs(z); // * | |
| 17 | a=abs(x*y*z); // * | |
| 18 | ||
| 19 | a=abs(x*y); // - | |
| 20 | $assert(x*y<=0); | |
| 21 | ||
| 22 | a=abs(x%y); //+ | |
| 23 | $assert(x%y>=0); | |
| 24 | ||
| 25 | a=abs((-x)%y); // + | |
| 26 | $assert((-x)%y>=0); | |
| [b1b88d8] | 27 | } |
Note:
See TracBrowser
for help on using the repository browser.
