View Full Version : float or double?

12-09-2005, 08:03 AM
I have a choice in glVertex and all the other related actions to use float or double.

What are the pros and cons (memory, speed, precision..)?

12-10-2005, 01:05 AM
Double typically has no benefit in real implementations, it just takes up more space so stick with float.

For most applications there is no difference. If you have a flight sim where you fly around the world and need to land on runways or get close to small objects or if you have a space opera where you fly between the planets double might help in theory but in practice it often doesn't.

Even in theory you'd want to use double precision matrix calls and stick with single precision vertex positions under local double precision transformation. In practice even for implementations where you have single precision float support and no real double precision support you can manage double precision numbers in software with subtraction and casts to float and stick with floats everywhere.

So the answer is it depends on the application, probaly not, and if you do only at the matrix nodes for correctly written software and in practice even if you need it I'd recommend other ways for practical support in real implementations like double precision software management with relative subtracts at the matrix nodes and casts to float.

12-10-2005, 01:39 AM
Thanks, you've helped me made up my mind.