Searching for fast complex numbers in C99 and C++
medium.com
medium.com
I have no idea, but it sounds like a lot to me.
http://www.felixcloutier.com/x86/MULSS.html http://www.felixcloutier.com/x86/MOVSS.html
So the final float multiplication is done by the hardware. What the software does, is to (a) handle the complex number and convert it to floats, and probably (b) handle the double precision using single precision x86 opcodes.
I realize these aren't directly comparable. However, it is hilariously depressing how many "dynamic" sites would be better served by a simple static html file.
Claiming you don't need all of it means analogically you would be fine with a car that turns only left and explodes on tuesdays. Which might be true for your case, but an abysmal set of limitations for a general purpose device.
The extra speed provided by imprecise math allows for bigger, longer simulations, which ultimately means more accuracy than what is lost in the floating-point operations.
A well defined floating point implementation is everyones benefit.
We had a bug once which was really hard to track down. Turned out a simple lack of initialization of a variable in a simple piece of code for a running average: the programmer reasoned in the first iteration this number is going to be multiplied with 0.0 anyway, so no need to initialize it. However because there are many NaN representations, once in a while the uninitialized memory of the variable happened to represent NaN, and NaN * 0.0 is still NaN, and that would keep on propagating, oops.
Likewise for rounding: we had some code calculating pixel positions and sometimes stuff was one pixel off resulting in weird visual artefacts. Turns out that when feeding the (faulty) rounding algorithm with results of some floating point calculations wouldn't do the expected thing but round down instead of up or so. Oops.
What I found remarkable though was the big difference I saw in old versus new compilers with respect to the diversity of random numbers generated. I first thought that it was the entropy available on my system but that didn't turn out to be the key factor. So watch out for old compilers!
The result being that there's edge cases they have to back up and 'fix' to be consistent. However, they could have just decided that complex arithmetic semantics follow naturally from floating point and whatever results ensue. So in the end this was all self-inflicted.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81478
Even though it's not a real bug, it's a missed optimization. My pitch is to emit the code to do the multiplication, and only call a fixup function when the results are NaN. If you short-circuit the NaN check, you only need 3 pretty cheap instructions to decide to call the standard library for help, and you can avoid it in the vast vast majority of cases. This should make multiplication and division much faster in the default case. Naturally the checks would still be elided with -fcx-limited-range is on.
I would rephrase this as, "If you care about floating point performance and have not investigated the compiler flags related to floating point performance, consider this a bug in your project."