madebits.com
C O D E
Roman Numerals
<<<

  Tools & Code
  webspider
  webnowse
  filewatcher
  adc
  vnotes
  ana
  magicsquare
  aes
  base32
  nsh
  mobcon
  hdb
  tgen
  urlsuite
  httppass
  albpad
  klarity
  poker
  shtypshqip
  roman
  calendar
  main






Software videos
Latest software videos!



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

Enter an arabic number:

Enter a roman number:

  Details

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
roman symblos use a overline to multiply by 1000 Q - 5000

T - 10000

? - 50000

? - 100000

? - 500000

? - 1000000

 

  Download

Roman Coverter

VersionTypeFileSizeComment
1.0.0source
~5KBThe code contains also a windows scripting host version.



Latest news by Google

madebits.com
home | legal | search | contact | top

©2005-2008