source:
CIVL/mods/dev.civl.com/examples/arithmetic/power_simplify2.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 229 bytes | |
| Rev | Line | |
|---|---|---|
| [e8576bf] | 1 | #include "math.h" |
| 2 | ||
| 3 | $input double m, expo; | |
| 4 | $assume(m != 0 && expo > 0); | |
| 5 | ||
| 6 | int main() { | |
| 7 | double x = -4. * m; | |
| 8 | ||
| 9 | x = pow(x, expo); | |
| 10 | x = pow(x, 1. / 2.); | |
| 11 | x = pow(x, 1. / expo); | |
| 12 | $assert(x == 2. * pow(-m, 1. / 2.)); | |
| 13 | return 0; | |
| 14 | } |
Note:
See TracBrowser
for help on using the repository browser.
