source: tests/complex.cfa @ 98d4df9

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 98d4df9 was 200fcb3, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

add auto newline to sout, change endl to nl

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[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 <stdio.h>
17#include <complex.h>
18#ifdef __CFA__
[73abe95]19#include <fstream.hfa>
[2f484f5]20#endif // __CFA
21
22int main( void ) {
23    double _Complex x = 3 + 2i, y = 4 + 5i, z;
24    z = x + y;
25    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
26#ifdef __CFA__
[200fcb3]27    sout | "x:" | x | "y:" | y | "z:" | z;
[2f484f5]28#endif // __CFA
29    x = 2.1 + 1.3i;
30    y = 3.2 + 4.5i;
31    z = x + y;
32    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
33#ifdef __CFA__
[200fcb3]34    sout | "x:" | x | "y:" | y | "z:" | z;
[2f484f5]35#endif // __CFA
36}
[a933bcb3]37
38// Local Variables: //
39// tab-width: 4 //
[dc8511c]40// compile-command: "cfa complex.cfa" //
[a933bcb3]41// End: //
Note: See TracBrowser for help on using the repository browser.