Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Jun 24, 2012 9:07 pm 
Offline

Joined: Sun Nov 13, 2011 5:23 am
Posts: 3
I think it makes more sense to use fixed-point to represent position. please correct me if I'm wrong.


reason: precision of floating-point depends on the location, and it is highly clustered around 0.
consequence: you can't expect position-invariant precision.
1. people should avoid positions too far from the origin.
2. precision at (0,0,1000000) depends on the axis direction

using fixed-point
pro: guarantees position-invariant precision.
con: max value is fixed, and you should use proper scale.


But I would say the fixed-point's con is not actually that bad, since too high value is discouraged even with the floating point. It only makes the bad practice explicitly impossible.

The attached imgs are

1. fixed point resolution with 7-bit integer.
2. floating point resolution with sign bit, 3-bit exponent and 3-bit mantissa
both are scaled to have the same max.


Attachments:
fixed_point.png
fixed_point.png [ 18.12 KiB | Viewed 877 times ]
floating_point.png
floating_point.png [ 19.51 KiB | Viewed 877 times ]
Top
 Profile  
 
PostPosted: Mon Jun 25, 2012 8:31 pm 
Offline

Joined: Sat Aug 19, 2006 11:52 pm
Posts: 198
I've come across this idea a couple times; here's a blog post that mentions the same concept (using 32bit or 64bit ints to store position): http://home.comcast.net/~tom_forsyth/blog.wiki.html#[[A%20matter%20of%20precision]]

(sorry about the lack of proper link, the formatting of the URL seems to be breaking this forums' embedding code)

In that article, the author suggests that implementing this would be straightforward -- position is stored in fixed-point, and all calculations happen in a local space with floating-point. I suspect that it's not as simple/easy as that (or, maybe it is and I'm not understanding the idea well enough), so if you have any experience to share, I'd be interested in hearing about it.


Top
 Profile  
 
PostPosted: Wed Jun 27, 2012 5:15 pm 
Offline

Joined: Tue Feb 20, 2007 4:56 pm
Posts: 179
... or you can basically have the best of all worlds and just use doubles.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group