Conversation
|
@isuruf A review? |
|
Can you fix the commit message? Otherwise +1 to merge |
d3f8856 to
7cad1cc
Compare
7cad1cc to
310a18e
Compare
|
Done. |
certik
left a comment
There was a problem hiding this comment.
Sorry for coming to this PR so late. I think we should rather just use the native C complex type. Here is an example how to use it:
#include <stdio.h>
#include <complex.h>
#include <tgmath.h>
int main(void)
{
double complex z1 = I * I; // imaginary unit squared
printf("I * I = %.1f%+.1fi\n", creal(z1), cimag(z1));
double complex z2 = pow(I, 2); // imaginary unit squared
printf("pow(I, 2) = %.1f%+.1fi\n", creal(z2), cimag(z2));
double PI = acos(-1);
double complex z3 = exp(I * PI); // Euler's formula
printf("exp(I*PI) = %.1f%+.1fi\n", creal(z3), cimag(z3));
double complex z4 = 1+2*I, z5 = 1-2*I; // conjugates
printf("(1+2i)*(1-2i) = %.1f%+.1fi\n", creal(z4*z5), cimag(z4*z5));
}| typedef struct dcomplex { | ||
| double real; | ||
| double imag; | ||
| } dcomplex; |
There was a problem hiding this comment.
Instead of defining our own complex type, why cannot we use the C complex type?
|
@certik This is exactly what was planned on implementing initially. Using double complex. The problem that arised was that using |
|
@ShikharJ would you mind creating a new issue for this? Let's discuss it over there, there must be some solution to that. |
|
I created an issue for it here: #1131 |
Relevant: Issue #1088 Feature 3.
For the course of development refer: PR #1122.