What happens when I use GCC and do computations with double values.
GCC uses on (x64 platforms which I assume here) https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
-mfpmath=sse (default) (use sse instructions)
-mpc80 (default) (rounding mode to 80bit extended precision)
I am confused, when I used 64bit double values in a simple C++ program.
is the computations now performed in extended precision (because of mpc80 default on) or does it use sse instructions (where there is not extended precision stuff going on)
What exactly happens? And what do I need to do on 64bit platforms, to ensure that in certain parts of the code only "double precision" is used, so assuming GCC by default does 80bit extended precision computations, then I need to set the the FPU unit to "double precision" in this part of the code manually?
No. On 64-bit mode, SSE instructions are used. -mpc80 (and other like options) only target 32-bit systems. (AFAIK)
If you want to be sure, do a runtime precision check.
In general, you should not rely on any degree of precision, though you can generally assume that double is, in fact, double precision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With