Float versus double

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

Re: Float versus double

Postby Geri » Sat Sep 12, 2015 2:21 pm

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.
Csontos kezünkbe a nyomor
Ezer év rúnáit véste

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

Re: Float versus double

Postby mattpharr » Fri Oct 16, 2015 4:00 pm

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

Postby rouncer » Wed Feb 03, 2016 5:37 pm

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.


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 1 guest