[offtopic] float vs. double?

Noel Yap nyap@garban.com
Tue Aug 4 04:44:00 GMT 1998


nbecker@fred.net wrote:
> 
> Has anyone done any benchmarks of float vs. double performance on
> Pentium II?  Is there anything much to be saved by using float over
> double?

Although I haven't done any benchmarks, the general literature says that
using double is faster on modern CPU's.  The reason is that the hardware
does double precision calculations anyway.  This means that floats will
be converted to double, the calculation performed, and, finally, the
answer will be converted back to float (assuming no optimizations).

Noel



More information about the Gcc mailing list