Last change
on this file since eb5dbfd was
afe2939,
checked in by Andrew Beach <ajbeach@…>, 4 years ago
|
Removed #include <stdio.h> from tests that only use printf.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[73abe95] | 1 | // |
---|
[a933bcb3] | 2 | // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
[73abe95] | 6 | // |
---|
[dc8511c] | 7 | // complex.cfa -- |
---|
[73abe95] | 8 | // |
---|
[a933bcb3] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Wed May 24 22:07:31 2017 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[200fcb3] | 12 | // Last Modified On : Tue Dec 4 21:34:21 2018 |
---|
| 13 | // Update Count : 4 |
---|
[73abe95] | 14 | // |
---|
[a933bcb3] | 15 | |
---|
[2f484f5] | 16 | #include <complex.h> |
---|
| 17 | #ifdef __CFA__ |
---|
[73abe95] | 18 | #include <fstream.hfa> |
---|
[2f484f5] | 19 | #endif // __CFA |
---|
| 20 | |
---|
| 21 | int main( void ) { |
---|
| 22 | double _Complex x = 3 + 2i, y = 4 + 5i, z; |
---|
| 23 | z = x + y; |
---|
| 24 | printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); |
---|
| 25 | #ifdef __CFA__ |
---|
[200fcb3] | 26 | sout | "x:" | x | "y:" | y | "z:" | z; |
---|
[2f484f5] | 27 | #endif // __CFA |
---|
| 28 | x = 2.1 + 1.3i; |
---|
| 29 | y = 3.2 + 4.5i; |
---|
| 30 | z = x + y; |
---|
| 31 | printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) ); |
---|
| 32 | #ifdef __CFA__ |
---|
[200fcb3] | 33 | sout | "x:" | x | "y:" | y | "z:" | z; |
---|
[2f484f5] | 34 | #endif // __CFA |
---|
| 35 | } |
---|
[a933bcb3] | 36 | |
---|
| 37 | // Local Variables: // |
---|
| 38 | // tab-width: 4 // |
---|
[dc8511c] | 39 | // compile-command: "cfa complex.cfa" // |
---|
[a933bcb3] | 40 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.