source:
tests/complex.cfa@
3b10778
| Last change on this file since 3b10778 was afe2939, checked in by , 5 years ago | |
|---|---|
|
|
| File size: 1.1 KB | |
| Line | |
|---|---|
| 1 | // |
| 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. |
| 6 | // |
| 7 | // complex.cfa -- |
| 8 | // |
| 9 | // Author : Peter A. Buhr |
| 10 | // Created On : Wed May 24 22:07:31 2017 |
| 11 | // Last Modified By : Peter A. Buhr |
| 12 | // Last Modified On : Tue Dec 4 21:34:21 2018 |
| 13 | // Update Count : 4 |
| 14 | // |
| 15 | |
| 16 | #include <complex.h> |
| 17 | #ifdef __CFA__ |
| 18 | #include <fstream.hfa> |
| 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__ |
| 26 | sout | "x:" | x | "y:" | y | "z:" | z; |
| 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__ |
| 33 | sout | "x:" | x | "y:" | y | "z:" | z; |
| 34 | #endif // __CFA |
| 35 | } |
| 36 | |
| 37 | // Local Variables: // |
| 38 | // tab-width: 4 // |
| 39 | // compile-command: "cfa complex.cfa" // |
| 40 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.