(原創) 浮点运算时,该使用float还是double? (C/C++) (C)
在C++ Primer 4th P.38,对float和double做了以下的建议
Determining which floating-point type to use is easier: It is almost always right to use double. The loss of precission implicit in float is significant, whereas the cost of double precision calculations versus single precision is negligible. In fact, on some machines, double precision is faster than single.
Reference
C++ Primer 4th P.38
Determining which floating-point type to use is easier: It is almost always right to use double. The loss of precission implicit in float is significant, whereas the cost of double precision calculations versus single precision is negligible. In fact, on some machines, double precision is faster than single.
Reference
C++ Primer 4th P.38