Questions on Geographic Information Systems Stack Exchange are expected to relate to geographic information systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.
If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers
4

The difference between float4 (32-bit float) and float8 (64-bit float, or double precision) depends on the context of what it is storing and how it is to be used. For many applications, float4 is sufficient, but GIS has particular demands on extra storage precision.

Consider storing UTM coordinates to millimeter precision. You might have a Northing of 4833438.204 measured using fancy survey equipment. Stored as float4, the number truncates to 4833438, loosing the millimetres. Stored as float8, the extra digits are preserved (down to the picometre scale). The reason why storing UTM coordinates is challenging, requiring double precision storage, is that they are typically on the order of hundreds of thousands to millions in scale.

The best way to visualize how floating point numbers are inaccurate is to think in terms of base-10 "floating point" values. You can use up to ten consecutive nonzero digits, and place the decimal point arbitrarily. Examples:

Basically, you can represent light years and millimeters, but adding a millimeter to a light year still gives you a light year. If you need more precision, you'd use an integer that is large enough that it can represent a light year in millimeters.

While true as far as it goes, your example doesn't mention the gotcha I've seen burn people most often: That the standard computer implementation stores floating point values with a binary mantissa which has a different subset of values that can be represented exactly than if it was stored in base 10. You can't represent the base 10 value 0.1 as a non-repeating binary value; the resulting rounding means that 0.1 + 0.1 + ... + 0.1 (10 times) will not equal 1.0.
–
Dan NeelyMay 10 '12 at 14:14