Advertisement
Data Processing

The Double Gallon: One "gal" Label, Two Measures 20.1% Apart, 0 of 60 Cross-Reads Recovered

The depot manager had done nothing careless. Two supplier sheets listed tank volumes in gallons, both spelled the unit the same way — "gal" — and both...

The depot manager had done nothing careless. Two supplier sheets listed tank volumes in gallons, both spelled the unit the same way — "gal" — and both were loaded into the same inventory under the declared convention that a gallon is a US gallon. The totals came out light, and the shortage hunt started with the drivers, then the seals, then the meters. Nobody suspected the unit label, because the label was present, spelled correctly and identical on every row. It was also ambiguous in a way no spelling check can see: some of those gallons were UK gallons, each one about a fifth larger than the US gallon the system assumed, and every one of those rows had been silently under-recorded from the moment it was read.

What The Double Gallon means

The Double Gallon means one unit label that names two different measures, so a correctly spelled string still underdetermines the value it carries. The nearest prior concept is The Silent Unit. The Silent Unit covered the opposite absence: the unit missing from the string entirely, with radians and gradians written as bare numbers, unidentifiable once merged because nothing in the row said which unit had ever applied. The Double Gallon is not an absence. Here the unit is present and spelled identically — "gal" — in both blocks, and the string still underdetermines the value, because the one label names two measures: the US gallon of 3.785412 litres and the UK gallon of 4.54609 litres, 20.1% apart at a ratio of 1.20095. The damage also differs in kind. A missing unit tends to collide rows visibly; a doubled unit produces silent error, row after row, each one plausible, each one wrong by about a fifth, and no error is ever raised.

1 Stop the Bleeding: Freeze Every "gal" Field Until Its Gallon Is Named

The immediate action is to stop every field, feed or import that carries volumes labelled "gal" from feeding totals, orders or compliance sums until the feed declares which gallon it means. The measured inventory holds 300 distinct volumes at two-decimal precision, from 0.50 to 500.00 litres, with a checksum of 7,250,686 in hundredths of a litre. Inventory B writes them five ways, 60 rows each, and the full parse reads "gal" as US gallons, the declared convention. Under that reading the recovery table is the quarantine list:

Written formRecovery of 60 under the US-gallon reading
Litres, 2 decimals60
Millilitres, integer60
US gallons, 2 decimals, labelled "gal"19
Cubic metres, 4 decimals6
UK gallons, 2 decimals, labelled "gal"0

The trap is quantified in the last row. The UK block recovers 0 of 60 under the US reading, and the cross-read in the other direction is just as total: the US block read under the UK factor also recovers 0 of 60. Every cross-read row is silently about 20% wrong, and none of the 120 cross-read values lands on its own item. The two blocks share zero identical "gal" strings in this inventory, even though their spelling ranges overlap — US spellings run 51.65 to 75.79 gal, UK spellings 63.37 to 85.39 gal — so there is no collision to trip an alarm. Quarantine means "gal" values are treated as unconverted text from now on: stored, displayed, never summed, until the source names its gallon.

2 Temporary Workaround: Convert Only the Litre Family, and Carry "gal" as Text With a Flag

While sources are being fixed, two workarounds keep the inventory usable without pretending the gallon rows are known. First, parse only what is unambiguous: the litre-family parse, which converts litres and millilitres and leaves "gal" and cubic metres unparsed, recovers 120 of 300 with zero false merges. Millilitres belong in that safe set on the evidence — two-decimal litres are whole millilitres, so the millilitre block is lossless at 60 of 60. Second, carry every "gal" row as its original string plus a flag that the gallon is undeclared, and exclude flagged rows from totals rather than converting them under a guessed convention. A flagged row can be priced later, once the supplier answers one question; a converted row has already spent its error. The full parse shows what guessing buys: 145 of 300 recovered, against the litre family's honest 120, with the measurement's single false merge — a US-block rounding collision in which 224.73 litres, spelled "59.37 gal", parses back to 224.74 litres, another row's value. Even the correct gallon, at two decimals, steps by 0.037854 litres against the 0.01 litre grid and recovers only 19 of its own 60 rows.

3 Root-Cause Fix: Make the Gallon Declare Itself at the Boundary

The root cause is a label with two meanings, so the fix must split the label, not add care to the reading of it. Schemas and feed specifications should reject a bare "gal" outright and accept only an explicitly named unit — US gallon or UK gallon — with the conversion factor fixed by that name: 3.785412 litres or 4.54609 litres. Historical rows should be re-sourced to their suppliers for a declaration, and any row whose gallon cannot be declared stays flagged rather than being assigned the house convention by default. The worked example shows the size of what a default assignment spends. Take 323.83 litres. Its own US spelling, "85.55 gal", parses back to 323.84 litres — one grid line out, the ordinary rounding cost of the two-decimal gallon. Its UK spelling, "71.23 gal", read as US gallons, parses back to 269.63 litres: 54.20 litres short, with no error raised, on a single mid-sized row. The same volume written as "0.3238 m3" parses back to 323.80 litres, and written as "323830 mL" it is exact. A depot running the UK-spelled feed under the US convention does not lose a rounding error; it loses about a fifth of every tank, invisibly, in the direction that makes stock look consumed that is still sitting in the yard.

4 Verification and Closure: Re-Run the 5 Forms and Count Both Cross-Reads

Closure is a count, not an impression. Rebuild the test inventory — 300 volumes at two decimals, written in the five forms — and re-run the staged parses. Before the fix, the expected counts are: exact string 60 of 300; litre-family parse 120 of 300 with zero false merges; full parse under the US convention 145 of 300 with exactly 1 false merge, the "59.37 gal" rounding collision described above. After the fix, every incoming "gal" row carries a declared gallon, and the verification adds the two cross-reads the trap was measured by: the US block read under the UK factor must recover 0 of 60, and the UK block read under the US factor must recover 0 of 60 — those zeroes are the proof that the two measures are genuinely different and that the declaration, not luck, is doing the work. The checksum of the inventory, the volumes summed in hundredths of a litre, is 7,250,686 and should be invariant across inventories. The item closes only when no undeclared "gal" string can enter the inventory at all; a parser improvement that still accepts the bare label leaves the trap armed.

The Double Gallon: One

Questions on The Double Gallon, answered

1. Can a parser tell a US gallon from a UK gallon by looking at the string? No. Both blocks use the identical label, "gal", and in this inventory the two blocks share zero identical "gal" strings, so there is not even a collision to warn about. The spelling ranges overlap, yet every cross-read value is silently about 20% wrong. Only a declaration from the source can separate them.

2. How large is the error when a UK gallon is read as a US gallon? About a fifth of the volume. The UK gallon is 4.54609 litres against the US gallon's 3.785412 litres, a ratio of 1.20095. In the worked example, 323.83 litres spelled in UK gallons and read as US gallons came back as 269.63 litres — 54.20 litres short, with no error raised — and across the block, cross-reads recovered 0 of 60 in both directions.

Conclusion: a volume labelled only "gal" is not a measurement but a guess between two measures 20.1% apart, and it should be rejected or flagged wherever it appears. Applicability conditions: this applies to any inventory, feed or archive where US and UK sources can both occur and the unit is carried as the bare label "gal"; where a single source is contractually fixed to one gallon and that fix is enforced at the boundary, the declared convention is sufficient, and the remaining risk is only the two-decimal gallon's own rounding, which recovered 19 of 60 even for the correct gallon.

Know someone who needs this? Share it.

Advertisement