Using double type in c ++ can be more "fast" in terms of runtime than using floats?

0

I have a program developed in c ++ in visual studio, which processes a huge amount of data! This program can either use float or double data, and this specification is done as follows:

typedef float/double real;

ie in the previous statement, or use double or float. However, I came across a problem for which I can not find justification. In the configurations of my project using the default floating point model: precise, the time the program takes to process the data in the case of floats is double in relation to doubles. If in the floating point model use the option fast, use floats or doubles, it takes roughly the same time, which does not surprise me. I just can not understand why the floating point model needs to be precise, the time it takes to use floats is much higher than using doubles (it takes twice as long). Thanks!

    
asked by anonymous 02.06.2015 / 18:56

1 answer

1

As Ivella commented, the "precise" mode is used for when you need more precision in calculations with float.

The extra time seems to be in the transmission of the extra bits in each of the operations. The document says that in this mode, 80 bits are used for each float. On a 64-bit system, this means the use of extra registers and / or double processor cycles to store these numbers in other memories.

See the Microsoft document on the subject: link

original in English: link

    
06.06.2015 / 01:33