View previous topic :: View next topic |
Author |
Message |
Guest
|
More Floating Point Accuracy |
Posted: Mon Nov 15, 2004 7:03 am |
|
|
I'm working with GPS data and I only get around 1000 foot resolution for distance measurements becuase of the limitations of the float. This isn't accurate enough so I'm looking for the easiest way to get more accuracy. I need trig functions so scaling doens't really work. Does anyone think it would be possible to get SoftFloat to compile? http://www.jhauser.us/arithmetic/SoftFloat.html
what have other people done to get around the inherant lack of precision in the built in float? |
|
![](templates/subSilver/images/spacer.gif) |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Mon Nov 15, 2004 8:24 am |
|
|
My projects involve GPS and measuring distances up to 1 mile. I use INT32 in my math up to a point where I can convert to float without loosing any significant resolution. INT32 will allow you some very large values to work with. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
.. |
Posted: Thu Nov 18, 2004 5:05 am |
|
|
aren't floats 32bit the same as int32? how can that give higher precision? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: .. |
Posted: Thu Nov 18, 2004 6:03 am |
|
|
Anonymous wrote: | aren't floats 32bit the same as int32? how can that give higher precision? |
Float, uses 23bits to actually hold the 'value', and the rest to hold the sign, and then the 'scale factor' to be applied to the value, and the sign of this. The basic 'accuracy' of a float, is only 2^23, but the key is that it can retain this over a huge range of number 'sizes'. The fixed point 32bit format, can use the whole 32bits to hold the value (or 31, assuming it is signed), so if you are working with numbers in a limited range, the fixed point arithmetic can potentially be 256* 'more accurate'. The arithmetic is also quicker.
Most people working here with this sort of data, have used integers this way.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|