source: tests/complex.cfa @ 7a8f5246

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 7a8f5246 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
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 <stdio.h>
17#include <complex.h>
18#ifdef __CFA__
19#include <fstream.hfa>
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__
27    sout | "x:" | x | "y:" | y | "z:" | z;
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__
34    sout | "x:" | x | "y:" | y | "z:" | z;
35#endif // __CFA
36}
37
38// Local Variables: //
39// tab-width: 4 //
40// compile-command: "cfa complex.cfa" //
41// End: //
Note: See TracBrowser for help on using the repository browser.