The Travelling Comma: one amount, five spellings, and a parser that reads 180 of them wrong
"125.551,58"...
"125.551,58"
That string is an amount of money: one hundred twenty-five thousand, five hundred fifty-one and fifty-eight hundredths, written in the convention used across most of Europe, where the point groups the thousands and the comma carries the decimals. Feed the same string to a parser built on the United States convention, where the comma groups and the point carries the decimals, and it reads 125.55, roughly one thousandth of the amount. Nothing in the string is malformed. No digit is wrong. The comma simply holds a different job in the two conventions, and a parser that assumes one job will not reject the string; it will read it, confidently, at the wrong value. This article asks how much of an amount inventory survives that assumption, and the answer is 120 of 300, with the other 180 read wrong rather than read not at all.
What The Travelling Comma means
The Travelling Comma is the condition in which the comma in a written amount changes jobs between conventions, serving as a thousands separator in one and as the decimal separator in another, so the same string carries different values to different readers. An amount exhibits it when its spelling is well formed under two conventions and the conventions assign it different values. The measurement behind this article generated 300 amounts between 100.00 and 250,000.00 with two decimals (checksum of values 37,821,333.21), wrote each in five spellings, and matched two inventories under three parsers (Source: evidence/sd_batch26_results.json, group AN22).
The nearest prior concept is The Shifted Comma, which covered grouping commas relocating inside a number when a different grouping convention is applied, Western against Indian, with the digits and the value untouched: the amount survived every relocation. The Travelling Comma is the dangerous sibling. Here the comma does not move within one job; it changes jobs entirely, from grouping to decimal, and the value moves with it, by a factor of a hundred or a thousand. Normalising grouping fixes the shifted comma. Applying the same normalisation here, stripping commas as if they were always grouping, is precisely the operation that destroys the amount.
1. The question
When an inventory of amounts written in several conventions is parsed by a reader that knows only one convention, how many amounts come through at their true value, how many are rejected, and how many are silently read at a wrong value? The third category is the one that matters, because a rejected amount announces itself and a wrong amount does not.
2. The short answer
Of 300 amounts, a single-locale parser built on the US convention reads 120 at their true value: the 60 written plainly with a decimal point and the 60 written in US grouped form. It reads the other 180 at wrong values, every one of them, and rejects none. A locale-aware parser that detects the convention from the separator pattern reads all 300 correctly. The damage is therefore entirely a function of the parser's assumption, not of the data: the same file scores 120 or 300 depending on one design decision.
3. The evidence: five spellings under two parsers
| Spelling | Example form | Read at true value, US-only parser (of 60) | Read at true value, locale-aware parser (of 60) |
|---|---|---|---|
| plain, decimal point | 125551.58 | 60 | 60 |
| US grouped | 125,551.58 | 60 | 60 |
| EU grouped | 125.551,58 | 0 | 60 |
| space grouped, decimal comma | 125 551,58 | 0 | 60 |
| plain, decimal comma | 125551,58 | 0 | 60 |
> Source: evidence/sd_batch26_results.json (batch 26 SD measurement run, group AN22).
The stage totals add the matching view. Exact string matching recovers 60 of 300. The single-locale parse recovers 120 of 300 with zero false merges: no amount is matched to a different amount, because the wrong values it manufactures, such as 12,555,158 for a plain decimal-comma amount, mostly fall outside the inventory's range or onto empty values. The full locale-aware parse recovers 300 of 300. The run's diagnostic count is the one to remember: 180 wrong values, 0 rejections, 0 false merges. The failure leaves almost no trace in a match report.
4. The exceptions: when the travelling comma does not bite
Three conditions protect an amount. First, size: an amount below 1,000 has no grouping separator in any convention, so its EU spelling is a plain decimal comma, which the US parser still reads wrong, by a factor of 100; small amounts are not protected, only differently wrong. Second, trailing zeros: an amount like 1,500.00 written as "1.500,00" is read by the US parser as 1.50, wrong by a thousand, so round amounts are not protected either. Third, genuine protection comes only from the file level: a declared convention, a header, or a parser that refuses amounts whose separator pattern is ambiguous. Within a single unlabelled file, no individual amount is safe, because safety is a property of the reader, not of the string.
5. Worked example: 125,551.58 in five spellings
The run's example amount, 125,551.58, shows all three outcomes. Written plainly as "125551.58" the US parser reads it exactly. Written as "125,551.58" it also reads it exactly, the grouping comma being stripped as designed. Written as "125.551,58" the parser strips the comma as grouping and reads the remaining point as a decimal point, returning 125.55, about one thousandth of the amount. Written as "125 551,58" it strips the space and the comma and returns 12,555,158, one hundred times the amount. Written as "125551,58" it likewise returns 12,555,158. The locale-aware parser, which treats the last separator as the decimal mark when both appear and a lone comma followed by two digits as a decimal comma, returns 125,551.58 for all five spellings. One amount, and the wrong reader is wrong in both directions, a thousandfold under on one spelling and a hundredfold over on two others.
Questions on The Travelling Comma, answered
1. Why does the US parser not reject the EU spellings? Because they are well-formed strings of digits and separators under its own rules too. "125.551,58" parses as a decimal number once the comma is stripped. Rejection would require the parser to check conventions, which is exactly what a single-locale parser does not do.
2. Which wrong direction is more common? Both occur in this run. Spellings with a grouping point and a decimal comma are read about a thousand times too small; spellings with a decimal comma and no grouping point are read one hundred times too large.
3. Would matching totals catch the error? A control total would: the 180 wrong values do not sum to the inventory's checksum. But record-level matching, the check most merges actually run, shows only unmatched records, and at low densities even those can look like ordinary source differences.
4. Is the space-grouped spelling realistic? Yes. Space grouping with a decimal comma is standard in several European conventions and in ISO-style formatting, and it is the spelling most likely to be mangled twice, once by a spreadsheet and once by a parser.
The answer, restated with its boundary, and the next action
Within this measurement's boundary, amounts from 100.00 to 250,000.00 in five common spellings, the travelling comma costs a single-locale parser 60 percent of the file, all of it silently. The next action for any team ingesting amounts from mixed sources is one line of defence, applied before parsing: detect the separator pattern of each file, declare its convention explicitly, and reject any file whose pattern is mixed or unreadable rather than letting a default locale decide. The comma will keep travelling. The parser's job is to ask it for its papers at the border.