source: src/tests/complex.c @ 58caf150

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 58caf150 was a933bcb3, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

documentation and formatting

  • 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.c --
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 : Wed May 24 22:08:01 2017
13// Update Count     : 1
14//
15
16#include <stdio.h>
17#include <complex.h>
18#ifdef __CFA__
19#include <fstream>
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 | endl;
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 | endl;
35#endif // __CFA
36}
37
38// Local Variables: //
39// tab-width: 4 //
40// compile-command: "cfa complex.c" //
41// End: //
Note: See TracBrowser for help on using the repository browser.