## Float versus double

Practical and theoretical implementation discussion.
Geri
Posts: 146
Joined: Fri Mar 02, 2012 7:01 pm

### Re: Float versus double

i use floats on most places, but some places, i use double, when i need to ensure precisity in some parts of the algo.

but i suggest you to use 32 bit integers instead, and 64 bit long longs, where it needed.

mattpharr
Posts: 9
Joined: Sat Jun 20, 2015 8:59 pm

### Re: Float versus double

JasonSmith wrote:I think I'll make this into one or more switches. Thanks for both your replies.

I've experienced precision issues in the past with objects far from the origin, or very strange in scale. It will be good to have a way to test the difference in quality and speed.

I think this is an interesting question. Anyone with more wisdom or experience, please share!
Something that helps with objects far from the origin is to transform the scene to camera space (i.e. where the camera is at the origin, generally looking down +z or -z). This places the highest fp precision close to the camera, where it's generally more useful. (Consider, for example, a scene where the camera is at (10000,10000,10000) looking at an object at (10001, 10001, 10001); in camera space, the object is at (1,1,1), which is much better precision-wise.

Matt

rouncer
Posts: 18
Joined: Wed Jun 19, 2013 11:04 am

### Re: Float versus double

64 bit is more for integers i think than decimals, but your stuck with a smaller scene with floating point values, ive seen it myself, the camera starts shaking a bit when you go out of 32 bit range.
So sometimes i guess you need to.