On x86 processors, at least, float
and double
will each be converted to a 10-byte real by the FPU for processing. The FPU doesn't have separate processing units for the different floating-point types it supports.
The age-old advice that float
is faster than double
applied 100 years ago when most CPUs didn't have built-in FPUs (and few people had separate FPU chips), so most floating-point manipulation was done in software. On these machines (which were powered by steam generated by the lava pits), it was faster to use float
s. Now the only real benefit to float
s is that they take up less space (which only matters if you have millions of them).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…