If you have any specific reason for this, use double.
Perhaps surprisingly, this is a double and not a float, which is a โnormalโ floating point type in C (and C ++). Standard math functions, such as sin and log , take doubling as arguments and return doubling. A regular floating-point literal, as when writing 3.14 in your program, is of type double. Do not swim.
On typical modern computers, doubling can be as fast as floats or even faster, so performance is usually not a factor to consider even for large calculations. (And it should be a lot of computing, or performance should not even enter your mind. My new i7 desktop can do six billion doubles in one second.)
Thomas Padron-McCarthy Sep 25 '09 at 8:12 2009-09-25 08:12
source share