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 | |
| Line | |
|---|---|
| 1 | #include <stdlib.h> |
| 2 | #include <civlc.cvh> |
| 3 | |
| 4 | $input int i; |
| 5 | $input int x; |
| 6 | $input int y; |
| 7 | $input int z; |
| 8 | $assume(x<0); |
| 9 | $assume(y>0); |
| 10 | void main(){ |
| 11 | int a = 9; |
| 12 | |
| 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); |
| 27 | } |
Note:
See TracBrowser
for help on using the repository browser.
