source:
CIVL/examples/arithmetic/ex3_simple.cvl
| Last change on this file was b689afd, checked in by , 4 weeks ago | |
|---|---|
|
|
| File size: 346 bytes | |
| Rev | Line | |
|---|---|---|
| [b0119b4] | 1 | #include <math.h> |
| 2 | #include <stdio.h> | |
| 3 | ||
| 4 | #define L 5 | |
| 5 | $input double a, b; | |
| [e33bcab] | 6 | $assume(a > 0); |
| [b0119b4] | 7 | $assume(a == b); |
| 8 | ||
| 9 | void main() { | |
| 10 | double y = a; | |
| 11 | int i; | |
| 12 | ||
| 13 | for(i=0; i<L; i++) { | |
| 14 | y = sqrt(y); | |
| 15 | printf("the %d time y = %f\n", i, y); | |
| 16 | } | |
| 17 | for(int i=0; i<L; i++) { | |
| 18 | y = y * y; | |
| 19 | printf("the %d time y = %f\n", i, y); | |
| 20 | } | |
| 21 | ||
| 22 | $assert(y == b); | |
| 23 | } |
Note:
See TracBrowser
for help on using the repository browser.
