source: src/tests/complex.c @ 2f484f5

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

add new test for complex numbers (needs work)

  • Property mode set to 100644
File size: 603 bytes
Line 
1#include <stdio.h>
2#include <complex.h>
3#ifdef __CFA__
4#include <fstream>
5#endif // __CFA
6
7int main( void ) {
8    double _Complex x = 3 + 2i, y = 4 + 5i, z;
9    z = x + y;
10    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
11#ifdef __CFA__
12    sout | "x:" | x | "y:" | y | "z:" | z | endl;
13#endif // __CFA
14    x = 2.1 + 1.3i;
15    y = 3.2 + 4.5i;
16    z = x + y;
17    printf( "x:%g+%gi y:%g+%gi z:%g+%gi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z) );
18#ifdef __CFA__
19    sout | "x:" | x | "y:" | y | "z:" | z | endl;
20#endif // __CFA
21}
Note: See TracBrowser for help on using the repository browser.