I was interested to know how large the error in positional and distance accuracy might be using single precision float variables, so did a couple of tests.

First, the circumference of the Earth is about 40,075,000 meters, so you clearly need 8 decimal digits to know where you are on that circle to within 1 meter. So, what is the consequence of storing that value in a single precision float?

The results from this modified version of the program demonstrates that the values of the stored coordinates are not the same as the entered values and *suggest* worst case about 4 meters distance error using the Haversine formula, based on single precision float positional accuracy (+/- 3 m) alone. GPS errors can be MUCH larger. Ignoring the latter source of error the distance will usually be correct to within +/- 2 m; not as bad as I thought!

```
float dlon = 1;
float dlat = 1;
float a = 1;
float c = 40074997.0; //estimate of the Earth's circumference in meters
float d = 1;
float long1 = -77.037852;
float long2 = -77.043934;
float lat1 = 38.898556;
float lat2 = 38.897147;
float d2r = PI / 180.0;
void setup() {
Serial.begin(9600);
for (int i = 0; i < 9; i++) Serial.println(c + i); //circumference as stored, in steps of 1 m
Serial.println("Coordinates as actually stored");
Serial.print(long1, 6);
Serial.print(", ");
Serial.println(lat1, 6);
Serial.print(long2, 6);
Serial.print(", ");
Serial.println(lat2, 6);
dlon = long2 - long1;
dlat = lat2 - lat1 ;
a = sq(sin(d2r * dlat / 2)) + cos(d2r * lat1) * cos(d2r * lat2) * sq(sin(d2r * dlon / 2));
c = 2 * atan2( sqrt(a), sqrt(1 - a) );
d = 6378137.0 * c;
Serial.println(d);
}
void loop() {}
```

For actual values 40074997, 40074998, 40074999, … prints instead:

```
40074996.00
40074996.00
40075000.00
40075000.00
40075000.00
40075000.00
40075000.00
40075004.00
40075004.00
Coordinates as actually stored
-77.037849, 38.898555
-77.043937, 38.897148
550.25
```