Should we generally use float literals for floats instead of the simpler double literals?
问题 In C++ (or maybe only our compilers VC8 and VC10) 3.14 is a double literal and 3.14f is a float literal. Now I have a colleague that stated: We should use float-literals for float calculations and double-literals for double calculations as this could have an impact on the precision of a calculation when constants are used in a calcualtion. Specifically, I think he meant: double d1, d2; float f1, f2; ... init and stuff ... f1 = 3.1415 * f2; f1 = 3.1415f * f2; // any difference? d1 = 3.1415 *