Extreme numbers test values
Numbers at the edges of their types, in foreign notations, and where precision runs out. 12 values, each with what it breaks and what a correct application does instead.
Type them one at a time with AltShiftN
in the palette, or take them all into a script with nkb emit numbers-extreme.
Largest safe JavaScript integer plus one
numbers-extreme/js-safe-plus-one
9007199254740992
9007199254740992
- 16 graphemes
- 16 code points
- 16 bytes
- 16 UTF-16 units
- What it breaks
- Above this value browsers and many interfaces stop representing whole numbers exactly, so an identifier returned by the server no longer matches what the user sees.
- What a correct application does
- Handled as text where exactness matters, or rejected with a stated limit.
32-bit integer maximum plus one
numbers-extreme/int32-max-plus-one
2147483648
2147483648
- 10 graphemes
- 10 code points
- 10 bytes
- 10 UTF-16 units
- What it breaks
- One past the most common integer limit - where counters, identifiers and quantities wrap to a negative number.
- What a correct application does
- Rejected with a message, or handled by a wider type consistently.
32-bit integer maximum
numbers-extreme/int32-max
2147483647
2147483647
- 10 graphemes
- 10 code points
- 10 bytes
- 10 UTF-16 units
- What it breaks
- The boundary itself: accepted here and failing one higher is the difference between a correct limit and an accident.
- What a correct application does
- Accepted where the limit allows it.
Minus one
numbers-extreme/minus-one
-1
-1
- 2 graphemes
- 2 code points
- 2 bytes
- 2 UTF-16 units
- What it breaks
- Quantity, price and count fields that never expected a negative value; often accepted and only noticed at invoicing.
- What a correct application does
- Rejected wherever a negative value is meaningless, with a message that says so.
Zero
numbers-extreme/zero
0
0
- 1 grapheme
- 1 code point
- 1 byte
- 1 UTF-16 unit
- What it breaks
- Distinguishing "zero" from "not filled in" is one of the most commonly confused boundaries in forms.
- What a correct application does
- Stored as zero and displayed as zero, never as an empty field.
Comma as the decimal separator
numbers-extreme/comma-decimal
3,14
3,14
- 4 graphemes
- 4 code points
- 4 bytes
- 4 UTF-16 units
- What it breaks
- The decimal separator used across most of Europe; parsers expecting a dot read it as a thousands separator or reject it.
- What a correct application does
- Accepted in locales that use it, or rejected with a message naming the expected format.
Spaces between thousands
numbers-extreme/thousands-space
1000000
1 000 000
- 9 graphemes
- 9 code points
- 9 bytes
- 9 UTF-16 units
- What it breaks
- Copying a number out of a report brings the group separators with it; most numeric parsers refuse.
- What a correct application does
- Separators stripped before parsing, or a message explaining the expected format.
Exponential notation
numbers-extreme/exp-notation
1e10
1e10
- 4 graphemes
- 4 code points
- 4 bytes
- 4 UTF-16 units
- What it breaks
- Spreadsheet exports produce this form for large numbers, so it arrives in fields that never expected it.
- What a correct application does
- Accepted and expanded, or rejected - never read as the digit 1.
Leading zeros
numbers-extreme/leading-zeros
007
007
- 3 graphemes
- 3 code points
- 3 bytes
- 3 UTF-16 units
- What it breaks
- Codes, room numbers and article numbers lose their leading zeros the moment they are treated as numbers.
- What a correct application does
- Preserved where the value is a code, not a quantity.
Typographic minus sign
numbers-extreme/minus-typographic
−1234
−1234
- 5 graphemes
- 5 code points
- 7 bytes
- 5 UTF-16 units
- What it breaks
- The typographic minus sign looks identical to the ASCII one and is rejected by every numeric parser.
- What a correct application does
- Normalised before parsing, or rejected with a message that names the character.
50 digits
numbers-extreme/fifty-digits
50 × 9
- 50 graphemes
- 50 code points
- 50 bytes
- 50 UTF-16 units
- What it breaks
- A number wider than any numeric type; usually produces an overflow or a raw error rather than a message.
- What a correct application does
- A readable message instead of an error page.
Plus sign before a number
numbers-extreme/plus-prefixed
+5
+5
- 2 graphemes
- 2 code points
- 2 bytes
- 2 UTF-16 units
- What it breaks
- An explicitly positive number, valid in most notations and rejected by many simple validators.
- What a correct application does
- Accepted and normalised, or rejected with a stated format.