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