Hi, all
I want to new a function which can calculate the complex subtract, here is my draft(Little Endian)
double minus(double a, double b)
{
float d[2]={0.0};
d[0] = -_hif(a) - (-_hif(b));
d[1] = _lof(a) - _lof(b);
return _ftod(d[1], d[0]);
}
So, if I want to calculate (3+4i) - (4+0i), I should code like this:
double b = _ftod(4, 3); double c = _ftod(0, 4); double d = minus(b, c);
But the output of printf("%f, %f\n", -_hif(d), _lof(d)) is 1.000000, -4.000000.
This is wrong, so whether I use _ftod(), _-hif(), _lof() or not?
Can anyone help me ?
THanks!