Case 869
The bounding box crossed the date line
the_bounding_box_crossed_the_date_line.eml - A region query returns every point inside the region's bounding box, and it builds that box from the region's real minimum and maximum longitudes. What min and max mean across the 180th meridian 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 region query
# returns every point inside the region's bounding box, and it builds that box
# from the region's real minimum and maximum longitudes. What min and max mean
# across the 180th meridian is computed below.
#
# The query is careful. It builds the box from the region's real vertices, not a
# hand-typed rectangle; it uses the engine's own box filter; it tests every
# point; and the intent is exactly 'the points inside the region'.
#
# The region straddles the antimeridian, running from 170 east through 180 to
# 170 west, and longitude wraps there, so the minimum is 170 west and the maximum
# is 170 east - a box spanning the whole world except the region.
100000 => points
500 => points_truly_in_the_region
99500 => points_truly_outside
20 => region_true_width_degrees
170 => box_east_edge_degrees_east
170 => box_west_edge_degrees_west
box_east_edge_degrees_east + box_west_edge_degrees_west => box_width_degrees
points_truly_outside => points_the_box_returned
0 => in_region_points_the_box_returned
points_truly_in_the_region - in_region_points_the_box_returned => region_points_missed
int(in_region_points_the_box_returned * 10000 / points_the_box_returned) => returned_that_are_in_region_per_myriad
"points : " + str(points) ^0
" truly in the region : " + str(points_truly_in_the_region) ^0
" truly outside : " + str(points_truly_outside) ^0
"region true width : " + str(region_true_width_degrees) + " degrees" ^0
"" ^0
"box, min to max longitude : 170 west to 170 east" ^0
"box width : " + str(box_width_degrees) + " degrees" ^0
"points the box returned : " + str(points_the_box_returned) ^0
" of them in the region : " + str(in_region_points_the_box_returned) ^0
"region points missed : " + str(region_points_missed) ^0
"returned that are in region : " + str(returned_that_are_in_region_per_myriad) + " per ten thousand" ^0
"" ^0
# ---- what the query verified ----
"the region query" ^0
" box built from : the region's real vertices" ^0
" filter : the engine's own bounding-box test" ^0
" tests : every point" ^0
" intent : the points inside the region" ^0
" points skipped : 0" ^0
" verdict : EVERY RETURNED POINT IS INSIDE THE BOX" ^0
"" ^0
" using the engine's box filter over every point is the" ^0
" part done right here, and it is why nothing outside the" ^0
" box is ever returned" ^0
"" ^0
# ---- what min and max mean at the antimeridian ----
"the box across 180" ^0
" the region's longitudes : 170 east, rising to 180, then" ^0
" 170 west" ^0
" what 170 west is as a number : minus 170" ^0
" so the minimum : minus 170; the maximum : 170" ^0
" the box that makes : minus 170 to 170, " + str(box_width_degrees) + " degrees wide" ^0
" what it contains : the whole world except the " + str(region_true_width_degrees) + "-degree" ^0
" strip the region actually occupies" ^0
"" ^0
# ---- what the caller got ----
"the result of the query" ^0
" points that should be returned : " + str(points_truly_in_the_region) ^0
" points that were returned : " + str(points_the_box_returned) ^0
" of those, actually in the region : " + str(in_region_points_the_box_returned) ^0
" region points missed : all " + str(region_points_missed) ^0
" is the box filter wrong : no; every returned point is" ^0
" inside the box" ^0
" is the box the region : no; it is the region's complement" ^0
"" ^0
# ---- null control ----
# The same region, with the box split at the antimeridian into two boxes (170 to
# 180 east, and 180 to 170 west), or longitudes normalized before min and max.
99500 => nc_returned_by_the_wrapped_box
500 => nc_returned_by_the_split_box
500 => nc_region_points_recovered
"null control - split the box at the antimeridian" ^0
" returned, single wrapped box : " + str(nc_returned_by_the_wrapped_box) ^0
" returned, two boxes split at 180 : " + str(nc_returned_by_the_split_box) ^0
" region points recovered : " + str(nc_region_points_recovered) ^0
" no point and no vertex changed; min and max stopped" ^0
" being taken across the wrap" ^0
"" ^0
# ---- the rule ----
"what a min-max bounding box guarantees" ^0
" every returned point lies between the min and max :" ^0
" exactly, the engine's own box filter" ^0
" every returned point lies in the region : not addressed;" ^0
" the region crosses 180 where longitude wraps, so min is" ^0
" minus 170 and max is 170, and the box is the world minus" ^0
" the region - " + str(points_the_box_returned) + " returned, " + str(in_region_points_the_box_returned) + " inside" ^0
"" ^0
"min and max assume a line, and longitude is a circle; across the seam the" ^0
"smallest and largest numbers bound everything except the span between them, so" ^0
"the box built from the region's own edges is the one place the region is not" ^0
"" ^0
"It builds the box from real vertices and filters every point with the engine's" ^0
"own test - nothing outside the box comes back. But the region crosses the" ^0
"antimeridian, so min-max spans " + str(box_width_degrees) + " degrees of everything else; " + str(points_the_box_returned) + " points" ^0
"returned, " + str(returned_that_are_in_region_per_myriad) + " per ten thousand of them in the region, and all " + str(region_points_missed) + " region points missed." ^0Python (deterministic transpilation)
pythonpoints = 100000
points_truly_in_the_region = 500
points_truly_outside = 99500
region_true_width_degrees = 20
box_east_edge_degrees_east = 170
box_west_edge_degrees_west = 170
box_width_degrees = box_east_edge_degrees_east + box_west_edge_degrees_west
points_the_box_returned = points_truly_outside
in_region_points_the_box_returned = 0
region_points_missed = points_truly_in_the_region - in_region_points_the_box_returned
returned_that_are_in_region_per_myriad = int(in_region_points_the_box_returned * 10000 / points_the_box_returned)
print("points : " + str(points))
print(" truly in the region : " + str(points_truly_in_the_region))
print(" truly outside : " + str(points_truly_outside))
print("region true width : " + str(region_true_width_degrees) + " degrees")
print("")
print("box, min to max longitude : 170 west to 170 east")
print("box width : " + str(box_width_degrees) + " degrees")
print("points the box returned : " + str(points_the_box_returned))
print(" of them in the region : " + str(in_region_points_the_box_returned))
print("region points missed : " + str(region_points_missed))
print("returned that are in region : " + str(returned_that_are_in_region_per_myriad) + " per ten thousand")
print("")
print("the region query")
print(" box built from : the region's real vertices")
print(" filter : the engine's own bounding-box test")
print(" tests : every point")
print(" intent : the points inside the region")
print(" points skipped : 0")
print(" verdict : EVERY RETURNED POINT IS INSIDE THE BOX")
print("")
print(" using the engine's box filter over every point is the")
print(" part done right here, and it is why nothing outside the")
print(" box is ever returned")
print("")
print("the box across 180")
print(" the region's longitudes : 170 east, rising to 180, then")
print(" 170 west")
print(" what 170 west is as a number : minus 170")
print(" so the minimum : minus 170; the maximum : 170")
print(" the box that makes : minus 170 to 170, " + str(box_width_degrees) + " degrees wide")
print(" what it contains : the whole world except the " + str(region_true_width_degrees) + "-degree")
print(" strip the region actually occupies")
print("")
print("the result of the query")
print(" points that should be returned : " + str(points_truly_in_the_region))
print(" points that were returned : " + str(points_the_box_returned))
print(" of those, actually in the region : " + str(in_region_points_the_box_returned))
print(" region points missed : all " + str(region_points_missed))
print(" is the box filter wrong : no; every returned point is")
print(" inside the box")
print(" is the box the region : no; it is the region's complement")
print("")
nc_returned_by_the_wrapped_box = 99500
nc_returned_by_the_split_box = 500
nc_region_points_recovered = 500
print("null control - split the box at the antimeridian")
print(" returned, single wrapped box : " + str(nc_returned_by_the_wrapped_box))
print(" returned, two boxes split at 180 : " + str(nc_returned_by_the_split_box))
print(" region points recovered : " + str(nc_region_points_recovered))
print(" no point and no vertex changed; min and max stopped")
print(" being taken across the wrap")
print("")
print("what a min-max bounding box guarantees")
print(" every returned point lies between the min and max :")
print(" exactly, the engine's own box filter")
print(" every returned point lies in the region : not addressed;")
print(" the region crosses 180 where longitude wraps, so min is")
print(" minus 170 and max is 170, and the box is the world minus")
print(" the region - " + str(points_the_box_returned) + " returned, " + str(in_region_points_the_box_returned) + " inside")
print("")
print("min and max assume a line, and longitude is a circle; across the seam the")
print("smallest and largest numbers bound everything except the span between them, so")
print("the box built from the region's own edges is the one place the region is not")
print("")
print("It builds the box from real vertices and filters every point with the engine's")
print("own test - nothing outside the box comes back. But the region crosses the")
print("antimeridian, so min-max spans " + str(box_width_degrees) + " degrees of everything else; " + str(points_the_box_returned) + " points")
print("returned, " + str(returned_that_are_in_region_per_myriad) + " per ten thousand of them in the region, and all " + str(region_points_missed) + " region points missed.")stdout (executed)
textpoints : 100000
truly in the region : 500
truly outside : 99500
region true width : 20 degrees
box, min to max longitude : 170 west to 170 east
box width : 340 degrees
points the box returned : 99500
of them in the region : 0
region points missed : 500
returned that are in region : 0 per ten thousand
the region query
box built from : the region's real vertices
filter : the engine's own bounding-box test
tests : every point
intent : the points inside the region
points skipped : 0
verdict : EVERY RETURNED POINT IS INSIDE THE BOX
using the engine's box filter over every point is the
part done right here, and it is why nothing outside the
box is ever returned
the box across 180
the region's longitudes : 170 east, rising to 180, then
170 west
what 170 west is as a number : minus 170
so the minimum : minus 170; the maximum : 170
the box that makes : minus 170 to 170, 340 degrees wide
what it contains : the whole world except the 20-degree
strip the region actually occupies
the result of the query
points that should be returned : 500
points that were returned : 99500
of those, actually in the region : 0
region points missed : all 500
is the box filter wrong : no; every returned point is
inside the box
is the box the region : no; it is the region's complement
null control - split the box at the antimeridian
returned, single wrapped box : 99500
returned, two boxes split at 180 : 500
region points recovered : 500
no point and no vertex changed; min and max stopped
being taken across the wrap
what a min-max bounding box guarantees
every returned point lies between the min and max :
exactly, the engine's own box filter
every returned point lies in the region : not addressed;
the region crosses 180 where longitude wraps, so min is
minus 170 and max is 170, and the box is the world minus
the region - 99500 returned, 0 inside
min and max assume a line, and longitude is a circle; across the seam the
smallest and largest numbers bound everything except the span between them, so
the box built from the region's own edges is the one place the region is not
It builds the box from real vertices and filters every point with the engine's
own test - nothing outside the box comes back. But the region crosses the
antimeridian, so min-max spans 340 degrees of everything else; 99500 points
returned, 0 per ten thousand of them in the region, and all 500 region points missed.Trace event types
eml:run:starteml:assigneml:outputeml:run:done