ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
Last change
on this file since 11ab8ea8 was 2f484f5, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago |
add new test for complex numbers (needs work)
|
-
Property mode
set to
100644
|
File size:
603 bytes
|
Rev | Line | |
---|
[2f484f5] | 1 | #include <stdio.h>
|
---|
| 2 | #include <complex.h>
|
---|
| 3 | #ifdef __CFA__
|
---|
| 4 | #include <fstream>
|
---|
| 5 | #endif // __CFA
|
---|
| 6 |
|
---|
| 7 | int 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.