Complex Multiplication uses more multiplications than necessary
(a + ib)(c + id) = (ac - bd) + (bc + ad)i (bc + ad) = (a+b)(c+d) - ac - bd
I reckon that you're right, but would that make any difference for such a library which is meant to be used at compile-time (and only at compile-time)? If not, I'd rather keep the naive albeit obvious formula which is currently used.
It could be interesting if the proposed formula somehow avoids precision loss for floating point numbers though, or if it is somehow less likely to overflow.
It could be interesting if the proposed formula somehow avoids precision loss for floating point numbers though, or if it is somehow less likely to overflow.
Faster compile times are also nice to have especially in the kinds of bonkers template-heavy programs that are likely to be using your library.
But does the change even make a significant difference in compile times?