The Problem with Elevations

I've been aware for years that my code for looking up Ordnance Survey elevation data was doing something weird when tallying up ascent and descent values for GPX files recorded by my GPS device when out for a bike ride. I had tested individual spot heights against OS maps, and was happy that I was retrieving the correct elevation value for each individual location: Here's a screenshot from my…