Written and Copyright by Todd Berk, 5/14/2009
Introduction This article is an investigation into whether single or double precision floating point numbers are required to accurately represent a position on Earth. The driving factor is that in embedded systems without floating point hardware units (most of them, i.e. PIC, AVR, ARM7...) calculations involving floating point numbers are very demanding, and the number of cycles required to compute increases exponentially between single precision (32-bit float) and double precision (64-bit double) floating point numbers. Trigonometry float point functions can take thousands (on 32-bit) to tens of thousands (on many 8-bit) of instructions to compute.
Meters per degree of latitude and longitude at various latitudesThe length between longitude and latitude lines changes with position on the earth, being greatest at the equator, and least near the poles. Here is a table of meters per degree of latitude, and meters per degree of longitude at various degrees of latitude:
Table 1: table of meters per degree of latitude, and meters per degree of longitude at various degrees of latitudeDistance between latitude lines varies slightly, while distance between longitude varies heavily. From table 1, it is evident that the maximum distance between longitude lines is about the same length as distance between latitude lines at the equator (zero degrees latitude). Precision of Float and DoubleAs with the distance between longitude and latitude, floating point numbers have various precision depending on the magnitude of the number being stored. Floating point numbers have higher precision when storing smaller numbers, which is an inverse relationship to the distance per degree magnitude (meters per degree longitude is smaller when latitude is greater). This relationship will work to our advantage with longitude, but distance between latitude does not really change with degrees latitude, so the latitude accuracy will be our limiting factor. The precision of a floating point number is called the Machine epsilon. For a single precision number (24 bits mantissa) the machine precision is: epsilon = 2-23 The following tables were calculated using the machine precision calculation: Worst Case ScenariosLongitude can vary from 0 to 180 degrees, and will have the least precision when at the equator and 180 degrees.
Table 2: Single Precision float accuracy worst case scenario (Global)The following table represents the works case scenarios for the entire United States Territories:
Table 3: United States total worst case scenarioSome other places of interest
ConclusionIt is shown that within the United States (all territories), the wost case latitude error is less than one meter, and the worst case longitude error is less than two meters. These errors are less than the standard GPS accuracy, as well as accuracy when using differential positioning. References1) IEEE-754 Floating-Point Conversion From Decimal Floating-Point: http://babbage.cs.qc.edu/IEEE-754/Decimal.html2) Length Of A Degree Of LatitudeAnd Longitude Calculator: http://www.fas.org/news/reference/calc/degree.html 3)Machine Epsilon: http://en.wikipedia.org/wiki/Machine_epsilon 4) Extreme points of the United States: http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States |