main
|
Last change
on this file was a1fbf85, checked in by Stephen Siegel <siegel@…>, 5 days ago |
|
Finished support of complex numbers for MPI, including reductions.
Started new approach to "apply". Trying to get rid of the $apply
system function and replace with pure CIVL-C.
Added more complex number tests, including for MPI.
|
-
Property mode
set to
100644
|
|
File size:
512 bytes
|
| Line | |
|---|
| 1 | #include <assert.h>
|
|---|
| 2 | #include <complex.h>
|
|---|
| 3 | #include <math.h>
|
|---|
| 4 |
|
|---|
| 5 | int main(void) {
|
|---|
| 6 | double s = sqrt(2.0);
|
|---|
| 7 | double _Complex x = s + s*I;
|
|---|
| 8 | double _Complex y = -s + s*I;
|
|---|
| 9 | double _Complex r;
|
|---|
| 10 |
|
|---|
| 11 | r = x += y;
|
|---|
| 12 | assert(x == 2*s*I);
|
|---|
| 13 | assert(y == -s + s*I);
|
|---|
| 14 | assert(r == x);
|
|---|
| 15 |
|
|---|
| 16 | r = x -= y;
|
|---|
| 17 | assert(x == s + s*I);
|
|---|
| 18 | assert(y == -s + s*I);
|
|---|
| 19 | assert(r == x);
|
|---|
| 20 |
|
|---|
| 21 | r = x *= y;
|
|---|
| 22 | assert(x == -4.0);
|
|---|
| 23 | assert(y == -s + s*I);
|
|---|
| 24 | assert(r == x);
|
|---|
| 25 |
|
|---|
| 26 | r = x /= y;
|
|---|
| 27 | assert(x == s + s*I);
|
|---|
| 28 | assert(y == -s + s*I);
|
|---|
| 29 | assert(r == x);
|
|---|
| 30 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.