calculating Lat and Long from Bearing and Distance

Your problem is on your first line.

Try

double dist = 150.0 / 6371.0;

The reason is that 150/6371 gets calculated as 0, because it performs integer division (rather than floating point division). This is true even though the result is being stored in a double. You can force floating point division by making one of the two numbers a floating point literal.

Leave a Comment