在
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
(原創) 浮点运算时,该使用float还是double? (C/C++) (C)
最新推荐文章于 2023-04-06 08:50:27 发布