Whole file

geographiclib/geographiclib-python

The author described this change as * Fix geodesic inversion so that nan + point on equator or pole returns all nans. Update tests to check this. * Fix bug in gedistance.m in handling equatorial lines.. It counts as a record because the check below fails on the code as it stood at 4e778cb92 and passes on 72d34d4d4, with nothing else changed between the two runs.

Fix saved2015-09-23
Sharing licenceMIT · LICENSE
Change size+3 2

What the code was meant to do, written into the code itself as a save note

* Fix geodesic inversion so that nan + point on equator or pole returns all nans. Update tests to check this. * Fix bug in gedistance.m in handling equatorial lines.

The change

694694 lat1 = Math.AngRound(Math.LatFix(lat1))
695695 lat2 = Math.AngRound(Math.LatFix(lat2))
696696 # Swap points so that point with higher (abs) latitude is point 1
697- swapp = 1 if abs(lat1) >= abs(lat2) else -1
697+ # If one latitude is a nan, then it becomes lat1.
698+ swapp = -1 if abs(lat1) < abs(lat2) else 1
698699 if swapp < 0:
699700 lonsign *= -1
700701 lat2, lat1 = lat1, lat2
982983
983984 def CheckPosition(lat, lon):
984985 """Check that lat and lon are legal and return normalized lon"""
985- if not (abs(lat) <= 90):
986+ if abs(lat) > 90:
986987 raise ValueError("latitude " + str(lat) + " not in [-90, 90]")
987988 # if not Math.isfinite(lon):
988989 # raise ValueError("longitude " + str(lon) + " not a finite number")

The check that tells the two apart

failpass·python/test/test_geodesic.py::GeodSolveTest::test_GeodSolve55

Check file python/test/test_geodesic.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it4e778cb920c05355908c9f1a7a1f7ff88f218183
Broken version dated2015-09-23
Modulepython.geographiclib.geodesic
Units changedGeodesic
Fingerprintb77134c4d9d05388
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in geographiclib/geographiclib-python