Roman Numerals
| | | "The Romans would never have found time to conquer the
world if they had been obliged first to learn Latin." - Heinrich Heine |
|
Roman numerals, such as XIII, use a different encoding from the Arabic numerals used nowadays. There is still some usage for the roman numerals, e.g., to enumerate nested numeric bulled lists, or just to look classically cool.
Small roman numerals are easy to decode, but the bigger the numbers become, the more difficult it is for a human to parse them. The code in this page is a full Roman to Arabic and vice-versa numerals converter built in JavaScript.
Enter a number in range 1 - 9999
The JavaScript parser is somehow interesting. It uses a predefined symbol table to mach the input string in order to try different lookahead lengths. The symbol ranges can be easily extended to allow numbers larger than 9999.
The code uses a different encoding for Roman numerals bigger than '4999' than the Romans did, as illustrated by the table below. Two additional symbols are used 'Q' for '5000', and 'T' for '10000'. The reason for this is that no Unicode encoding exists for the real overlined Roman symbols.
| Roman Symbol | Symbol Used Here |
 |
Q - 5000
T - 10000
? - 50000
? - 100000
? - 500000
? - 1000000
|

Roman Coverter |
|
| Version | Type | File | Size | Comment |
|---|
| 1.0.0 | source | | ~5KB | The code contains also a windows scripting host version. |