diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-10 22:04:28 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-10 22:04:28 +0100 |
commit | f76a183550b2eb9ceb87d947ef7418a57b1b349f (patch) | |
tree | 2b0aa561304b30ee8096058a155f4c2b1c74dfb0 /test/monniaux/complex | |
parent | 2aaf154d3b6aec244d3dc014a5a38fb6b5952b1d (diff) | |
download | compcert-kvx-f76a183550b2eb9ceb87d947ef7418a57b1b349f.tar.gz compcert-kvx-f76a183550b2eb9ceb87d947ef7418a57b1b349f.zip |
complex numbers attempt
Diffstat (limited to 'test/monniaux/complex')
-rw-r--r-- | test/monniaux/complex/complex.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/monniaux/complex/complex.c b/test/monniaux/complex/complex.c new file mode 100644 index 00000000..77fa13da --- /dev/null +++ b/test/monniaux/complex/complex.c @@ -0,0 +1,22 @@ +#include <stdio.h> + +typedef struct { + double re, im; +} complex_double; + +static inline void add_complex_double(complex_double *r, + const complex_double *x, + const complex_double *y) { + double re = x->re + y->re; + double im = x->im + y->im; + r->re = re; + r->im = im; +} + +int main() { + complex_double a = { 1, 2 }; + complex_double b = { 7, 4 }; + complex_double r; + add_complex_double(&r, &a, &b); + printf("%g %g\n", r.re, r.im); +} |