import math
def eadist(lat1, lon1, lat2, lon2):
print(lat1, lon1, lat2, lon2)
d2r = math.pi / 180
R = 6378
dlat = (lat2 -lat1) * d2r
dlon = (lon2 -lon1) * d2r
a = (math.sin(dlat/2))**2 + math.cos(lat1*d2r)*math.cos(lat2*d2r) * (math.sin(dlon/2))**2
print("a=",a)
c = 2*math.asin(math.sqrt(a))
print("c=",c)
dist = c * R
return dist
print(eadist(45, 90, 45, 91))
print(eadist(45, 90, 46, 90))
print(eadist(45, 90, 46, 91))
print(eadist(45, 90, -45, -90))
aW1wb3J0IG1hdGgKZGVmIGVhZGlzdChsYXQxLCBsb24xLCBsYXQyLCBsb24yKToKICAgIHByaW50KGxhdDEsIGxvbjEsIGxhdDIsIGxvbjIpCiAgICBkMnIgPSBtYXRoLnBpIC8gMTgwCiAgICBSID0gNjM3OAogICAgZGxhdCA9IChsYXQyIC1sYXQxKSAqIGQycgogICAgZGxvbiA9IChsb24yIC1sb24xKSAqIGQycgogICAgYSA9IChtYXRoLnNpbihkbGF0LzIpKSoqMiArIG1hdGguY29zKGxhdDEqZDJyKSptYXRoLmNvcyhsYXQyKmQycikgKiAobWF0aC5zaW4oZGxvbi8yKSkqKjIKICAgIHByaW50KCJhPSIsYSkKICAgIGMgPSAyKm1hdGguYXNpbihtYXRoLnNxcnQoYSkpCiAgICBwcmludCgiYz0iLGMpCiAgICBkaXN0ID0gYyAqIFIKICAgIHJldHVybiBkaXN0CgpwcmludChlYWRpc3QoNDUsIDkwLCA0NSwgOTEpKQpwcmludChlYWRpc3QoNDUsIDkwLCA0NiwgOTApKQpwcmludChlYWRpc3QoNDUsIDkwLCA0NiwgOTEpKQpwcmludChlYWRpc3QoNDUsIDkwLCAtNDUsIC05MCkp