source:
CIVL/examples/library/math/sqrt.c@
f04ee45
| Last change on this file since f04ee45 was 712457c, checked in by , 11 years ago | |
|---|---|
|
|
| File size: 338 bytes | |
| Line | |
|---|---|
| 1 | #include<assert.h> |
| 2 | #include<math.h> |
| 3 | #include<stdio.h> |
| 4 | #ifdef _CIVL |
| 5 | #include<civlc.cvh> |
| 6 | $assume(sqrt(1)==1); |
| 7 | #endif |
| 8 | |
| 9 | int main(int argc, char** argv) { |
| 10 | double a = 1.0/4.0; |
| 11 | double b = 1.0/3.0; |
| 12 | double c = 1.0; |
| 13 | double x = (sqrt(c)*sqrt(c)*b - a)/(sqrt(c)*sqrt(c)); |
| 14 | printf("FOO: %f\n", x); |
| 15 | x = sqrt(x); |
| 16 | printf("BAR: %f\n", x); |
| 17 | } |
| 18 |
Note:
See TracBrowser
for help on using the repository browser.
