source:
CIVL/examples/contracts/extendQuant.c@
bb03188
| Last change on this file since bb03188 was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 365 bytes | |
| Rev | Line | |
|---|---|---|
| [bfafee3] | 1 | //#include<mpi.h> |
| 2 | #include<civlc.cvh> | |
| [e84bca3] | 3 | #include<stdio.h> |
| [bfafee3] | 4 | |
| 5 | /*@ | |
| 6 | @ ensures \result == 2*x; | |
| 7 | @*/ | |
| 8 | $atomic_f int g(int x){ | |
| 9 | return 2*x; | |
| 10 | } | |
| 11 | ||
| 12 | /*@ | |
| [e84bca3] | 13 | @ requires x==0 && y>x && y<=4; |
| [bfafee3] | 14 | @ ensures \result==\sum(x,y, \lambda int i; 2*i); |
| 15 | @*/ | |
| 16 | int f(int x, int y){ | |
| 17 | int r=0; | |
| 18 | ||
| 19 | for(int i=x; i<=y; i++) | |
| 20 | r+=i*2; | |
| [e84bca3] | 21 | printf("x=%d, y=%d, result=%d\n", x, y, r); |
| [bfafee3] | 22 | return r; |
| 23 | } |
Note:
See TracBrowser
for help on using the repository browser.
