Case 871
The degrees were measured on a flat plane
the_degrees_were_measured_on_a_flat_plane.eml - A dispatch service picks the nearest warehouse to a customer, and it applies its distance formula to the real coordinates of every warehouse. What a degree of longitude is worth is computed below.
ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-16
EML
eml# Self-authored for the EML case corpus (no external origin). A dispatch service
# picks the nearest warehouse to a customer, and it applies its distance formula
# to the real coordinates of every warehouse. What a degree of longitude is worth
# is computed below.
#
# The pick is careful. It reads the real latitude and longitude of the customer
# and of every warehouse, not a cached guess; it applies one distance formula
# uniformly; it compares every candidate; and the intent is exactly 'the
# warehouse closest to the customer'.
#
# The formula treats degrees as a flat grid, and a degree of longitude is 111 km
# at the equator but shrinks with the cosine of the latitude - at 60 north it is
# 56 km, so an east-west gap is counted at twice its length.
111 => km_per_degree_of_latitude
56 => km_per_degree_of_longitude_at_60_north
3 => warehouse_a_degrees_east_of_customer
2 => warehouse_b_degrees_north_of_customer
warehouse_a_degrees_east_of_customer * km_per_degree_of_latitude => a_km_as_flat_degrees
warehouse_b_degrees_north_of_customer * km_per_degree_of_latitude => b_km_as_flat_degrees
warehouse_a_degrees_east_of_customer * km_per_degree_of_longitude_at_60_north => a_km_true
warehouse_b_degrees_north_of_customer * km_per_degree_of_latitude => b_km_true
a_km_as_flat_degrees - a_km_true => km_the_flat_grid_added_to_a
int(km_the_flat_grid_added_to_a * 10000 / a_km_true) => a_overstated_per_myriad
b_km_true - a_km_true => km_farther_the_chosen_warehouse_is
"customer latitude : 60 north" ^0
"warehouse A : " + str(warehouse_a_degrees_east_of_customer) + " degrees east" ^0
"warehouse B : " + str(warehouse_b_degrees_north_of_customer) + " degrees north" ^0
"" ^0
"A, degrees read as a flat grid : " + str(a_km_as_flat_degrees) + " km" ^0
"B, degrees read as a flat grid : " + str(b_km_as_flat_degrees) + " km" ^0
"A, true distance : " + str(a_km_true) + " km" ^0
"B, true distance : " + str(b_km_true) + " km" ^0
"picked by the flat grid : B" ^0
"actually nearest : A" ^0
"A overstated by the flat grid : " + str(a_overstated_per_myriad) + " per ten thousand" ^0
"" ^0
# ---- what the pick verified ----
"the nearest-warehouse pick" ^0
" reads : the real coordinates of the customer and every" ^0
" warehouse, not a cached guess" ^0
" formula : one distance formula, applied uniformly" ^0
" compares : every candidate" ^0
" intent : the warehouse closest to the customer" ^0
" candidates skipped : 0" ^0
" verdict : B IS THE CLOSEST BY THE FORMULA" ^0
"" ^0
" applying one formula to the real coordinates of every" ^0
" candidate is the part done right here, and it is why the" ^0
" ranking is consistent and reproducible" ^0
"" ^0
# ---- what a degree of longitude is worth ----
"a degree, north-south and east-west" ^0
" one degree of latitude : 111 km, everywhere" ^0
" one degree of longitude : 111 km at the equator, times" ^0
" the cosine of the latitude" ^0
" at 60 north the cosine is one half : 56 km" ^0
" what the flat grid assumes : a degree east is a degree" ^0
" north" ^0
" so A's 3 degrees east : counted as 333 km, actually 168" ^0
"" ^0
# ---- what the caller got ----
"the dispatch" ^0
" warehouse chosen : B, at " + str(b_km_true) + " km" ^0
" warehouse that was nearest : A, at " + str(a_km_true) + " km" ^0
" extra distance on every delivery : " + str(km_farther_the_chosen_warehouse_is) + " km" ^0
" is the formula applied wrong : no; it is applied exactly" ^0
" is a degree a unit of distance : no; east-west it is a" ^0
" unit that shrinks toward the poles" ^0
"" ^0
# ---- null control ----
# The same pick, with longitude differences scaled by the cosine of the latitude
# before comparing (or a great-circle distance).
333 => nc_a_km_flat
168 => nc_a_km_scaled
1 => nc_picks_a_once_scaled
"null control - scale longitude by the cosine of the latitude" ^0
" A by the flat grid : " + str(nc_a_km_flat) + " km" ^0
" A once longitude is scaled : " + str(nc_a_km_scaled) + " km" ^0
" picks A once scaled : " + str(nc_picks_a_once_scaled) ^0
" no coordinate and no warehouse changed; a degree east" ^0
" stopped being counted as a degree north" ^0
"" ^0
# ---- the rule ----
"what a flat-grid nearest pick guarantees" ^0
" the candidate with the smallest degree-distance is" ^0
" chosen : exactly, one formula over every candidate" ^0
" the nearest warehouse is chosen : not addressed; a degree" ^0
" of longitude at 60 north is 56 km, not 111, so A's " + str(a_km_true) + " km" ^0
" was read as " + str(a_km_as_flat_degrees) + " and the farther B was dispatched" ^0
"" ^0
"degrees are angles, not lengths; north-south an angle is a fixed distance, but" ^0
"east-west the same angle spans less ground the closer it is to a pole, and a grid" ^0
"that treats them alike measures the map and not the earth" ^0
"" ^0
"It applies one formula to the real coordinates of every warehouse - the ranking" ^0
"is exact for what it measures. But it measures degrees as a flat grid, and at 60" ^0
"north a degree east is 56 km not 111, so A at " + str(a_km_true) + " km was read as " + str(a_km_as_flat_degrees) + "," ^0
"" + str(a_overstated_per_myriad) + " per ten thousand overstated, and B at " + str(b_km_true) + " km was dispatched." ^0Python (deterministic transpilation)
pythonkm_per_degree_of_latitude = 111
km_per_degree_of_longitude_at_60_north = 56
warehouse_a_degrees_east_of_customer = 3
warehouse_b_degrees_north_of_customer = 2
a_km_as_flat_degrees = warehouse_a_degrees_east_of_customer * km_per_degree_of_latitude
b_km_as_flat_degrees = warehouse_b_degrees_north_of_customer * km_per_degree_of_latitude
a_km_true = warehouse_a_degrees_east_of_customer * km_per_degree_of_longitude_at_60_north
b_km_true = warehouse_b_degrees_north_of_customer * km_per_degree_of_latitude
km_the_flat_grid_added_to_a = a_km_as_flat_degrees - a_km_true
a_overstated_per_myriad = int(km_the_flat_grid_added_to_a * 10000 / a_km_true)
km_farther_the_chosen_warehouse_is = b_km_true - a_km_true
print("customer latitude : 60 north")
print("warehouse A : " + str(warehouse_a_degrees_east_of_customer) + " degrees east")
print("warehouse B : " + str(warehouse_b_degrees_north_of_customer) + " degrees north")
print("")
print("A, degrees read as a flat grid : " + str(a_km_as_flat_degrees) + " km")
print("B, degrees read as a flat grid : " + str(b_km_as_flat_degrees) + " km")
print("A, true distance : " + str(a_km_true) + " km")
print("B, true distance : " + str(b_km_true) + " km")
print("picked by the flat grid : B")
print("actually nearest : A")
print("A overstated by the flat grid : " + str(a_overstated_per_myriad) + " per ten thousand")
print("")
print("the nearest-warehouse pick")
print(" reads : the real coordinates of the customer and every")
print(" warehouse, not a cached guess")
print(" formula : one distance formula, applied uniformly")
print(" compares : every candidate")
print(" intent : the warehouse closest to the customer")
print(" candidates skipped : 0")
print(" verdict : B IS THE CLOSEST BY THE FORMULA")
print("")
print(" applying one formula to the real coordinates of every")
print(" candidate is the part done right here, and it is why the")
print(" ranking is consistent and reproducible")
print("")
print("a degree, north-south and east-west")
print(" one degree of latitude : 111 km, everywhere")
print(" one degree of longitude : 111 km at the equator, times")
print(" the cosine of the latitude")
print(" at 60 north the cosine is one half : 56 km")
print(" what the flat grid assumes : a degree east is a degree")
print(" north")
print(" so A's 3 degrees east : counted as 333 km, actually 168")
print("")
print("the dispatch")
print(" warehouse chosen : B, at " + str(b_km_true) + " km")
print(" warehouse that was nearest : A, at " + str(a_km_true) + " km")
print(" extra distance on every delivery : " + str(km_farther_the_chosen_warehouse_is) + " km")
print(" is the formula applied wrong : no; it is applied exactly")
print(" is a degree a unit of distance : no; east-west it is a")
print(" unit that shrinks toward the poles")
print("")
nc_a_km_flat = 333
nc_a_km_scaled = 168
nc_picks_a_once_scaled = 1
print("null control - scale longitude by the cosine of the latitude")
print(" A by the flat grid : " + str(nc_a_km_flat) + " km")
print(" A once longitude is scaled : " + str(nc_a_km_scaled) + " km")
print(" picks A once scaled : " + str(nc_picks_a_once_scaled))
print(" no coordinate and no warehouse changed; a degree east")
print(" stopped being counted as a degree north")
print("")
print("what a flat-grid nearest pick guarantees")
print(" the candidate with the smallest degree-distance is")
print(" chosen : exactly, one formula over every candidate")
print(" the nearest warehouse is chosen : not addressed; a degree")
print(" of longitude at 60 north is 56 km, not 111, so A's " + str(a_km_true) + " km")
print(" was read as " + str(a_km_as_flat_degrees) + " and the farther B was dispatched")
print("")
print("degrees are angles, not lengths; north-south an angle is a fixed distance, but")
print("east-west the same angle spans less ground the closer it is to a pole, and a grid")
print("that treats them alike measures the map and not the earth")
print("")
print("It applies one formula to the real coordinates of every warehouse - the ranking")
print("is exact for what it measures. But it measures degrees as a flat grid, and at 60")
print("north a degree east is 56 km not 111, so A at " + str(a_km_true) + " km was read as " + str(a_km_as_flat_degrees) + ",")
print("" + str(a_overstated_per_myriad) + " per ten thousand overstated, and B at " + str(b_km_true) + " km was dispatched.")stdout (executed)
textcustomer latitude : 60 north
warehouse A : 3 degrees east
warehouse B : 2 degrees north
A, degrees read as a flat grid : 333 km
B, degrees read as a flat grid : 222 km
A, true distance : 168 km
B, true distance : 222 km
picked by the flat grid : B
actually nearest : A
A overstated by the flat grid : 9821 per ten thousand
the nearest-warehouse pick
reads : the real coordinates of the customer and every
warehouse, not a cached guess
formula : one distance formula, applied uniformly
compares : every candidate
intent : the warehouse closest to the customer
candidates skipped : 0
verdict : B IS THE CLOSEST BY THE FORMULA
applying one formula to the real coordinates of every
candidate is the part done right here, and it is why the
ranking is consistent and reproducible
a degree, north-south and east-west
one degree of latitude : 111 km, everywhere
one degree of longitude : 111 km at the equator, times
the cosine of the latitude
at 60 north the cosine is one half : 56 km
what the flat grid assumes : a degree east is a degree
north
so A's 3 degrees east : counted as 333 km, actually 168
the dispatch
warehouse chosen : B, at 222 km
warehouse that was nearest : A, at 168 km
extra distance on every delivery : 54 km
is the formula applied wrong : no; it is applied exactly
is a degree a unit of distance : no; east-west it is a
unit that shrinks toward the poles
null control - scale longitude by the cosine of the latitude
A by the flat grid : 333 km
A once longitude is scaled : 168 km
picks A once scaled : 1
no coordinate and no warehouse changed; a degree east
stopped being counted as a degree north
what a flat-grid nearest pick guarantees
the candidate with the smallest degree-distance is
chosen : exactly, one formula over every candidate
the nearest warehouse is chosen : not addressed; a degree
of longitude at 60 north is 56 km, not 111, so A's 168 km
was read as 333 and the farther B was dispatched
degrees are angles, not lengths; north-south an angle is a fixed distance, but
east-west the same angle spans less ground the closer it is to a pole, and a grid
that treats them alike measures the map and not the earth
It applies one formula to the real coordinates of every warehouse - the ranking
is exact for what it measures. But it measures degrees as a flat grid, and at 60
north a degree east is 56 km not 111, so A at 168 km was read as 333,
9821 per ten thousand overstated, and B at 222 km was dispatched.Trace event types
eml:run:starteml:assigneml:outputeml:run:done