Integration by me

Then you will know the truth, and the truth will set you free.

Don't implement CMPLX with +

For brevity, let’s forget that CMPLX is a macro. The following code seems to be a cross-platform solution.

inline double _Complex CMPLX(double x, double y)
	return x + I * y;

Actually, it is not. Whether I is complex or imaginary, I * y evaluates to (+0, y) when added with a real number. If x happens to be -0, its sign is not preserved because -0 + +0 = +0.

I think we can only stick with compiler-specific constructs for now. :(

Author: Chen-Pang He

I’m Chen-Pang He (何震邦), studying medicine in Taipei Medical University. I’m a programmer skilled in calculus and linear algebra. See the for more details.