Float vs. double in math.h and arduino libraries

Before I get too far down this road, I thought I'd ask some opinions. I want to use some of the functions in math.h to do some GPS calculations ( see Calculate distance and bearing between two Latitude/Longitude points using haversine formula in JavaScript for a bunch of useful formulas). Math.h requires the use of type double rather than type float. I recognize that on AVR devices both types use four bytes of storage. The real question is are the types interchangeable? They appear to have different ranges and degrees of precision. Does there need to be an explicit conversion or just typecasting, or should I just avoid all Arduino functions and just use math.h calls for all math?

Thanks.

Ed

Float and double are the same on the Arduino and therefore interchangable. The avr gcc compiler implements both float and double as 32-bit IEEE 754.

You may need to test a few trial values to see if you can get sufficient accuracy. I would be interested to hear about the results.

Good luck!

Thanks for the reply. After I get this up and running I'll post some results. Accuracy will be an issue; I hope to be able to determine if location "A" is within 0.1 or 0.2 km of location "B".