Hi Guys,

I'm trying to port the destination formula from here:

Calculate distance and bearing between two Latitude/Longitude points using Haversine formula in JavaScript

So far, I have this:

Code:int brng; brng = 90; float lat1 = GPSlat; float lon1 = GPSlon; float lat2; float lon2; double dLat = d*cos(brng); lat2 = lat1 + dLat; double dPhi = log(tan(lat2/2+PI/4)/tan(lat1/2+PI/4)); double q = (isfinite(dLat/dPhi)) ? dLat/dPhi : cos(lat1); // E-W line gives dPhi=0 double dLon = d*sin(brng)/q; // check for some daft bugger going past the pole, normalise latitude if so if (abs(lat2) > PI/2) lat2 = lat2>0 ? PI-lat2 : -PI-lat2; lon2 = (lon1+dLon+PI)%(2*PI) - PI;

but the C compiler doesn't like the % sign in the last line.

What is that doing?

Cheers, Art.