Eventually I'd like to drive a heliostat (servo- or stepper-controlled tracking mount)
This suggests to me that the precision you actually need will be determined by the resolution of your tracking hardware.My knee-jerk reaction is that you don't really need double precision. But then, I don't know the formulas/values involved, either.
but this just seems like such an inelegant solution, compared to simply using an additional 4 bytes of ram for a proper double-float. I'm quite surprised that this, of all things, would be a sticking-point.
can't one just include and link the double math library that is available?
the math contains terms that vary over many different timescales, from seconds to centuries.
I really don't think you need double precision to do this.
dist = acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon2-lon1));
// alternative formulae (haversine) const float two=2.0; dist = two*asin(sqrt(square(sin((lat1-lat2)/two)) + cos(lat1)*cos(lat2)*square(sin((lon2-lon1)/two))));