Roman Numeral Conversion
Anybody know of a little utility to convert Roman numerals to Arabic numerals; type in the Roman, get the Arabic?
Checking around there's a nice looking (but will not compile) library at SourceForge, couple of Windowish things, none of which compile or run without a lot of twiddling and fiddling. Can't use a web-based converter (there's a really nice one at http://www.onlineconversion.com/roma...s_advanced.htm but it can't be used at the site, no Internet connection). A little click-'n'-drool thing would be the berries (bunch of Windows folk that don't like command line too much) and I'm just not too capable with Java or some such. Heck, ncurses would be good enough. The conversion is trivial, but the simple-to-use part without opening a terminal window ain't. |
This one appears not to require a connection.
http://www.novaroma.org/via_romana/numbers.html Just need a browser to display the page. |
What's funny about your question is that word algorithm is derived from that of Persian mathematician عَبْدَالله مُحَمَّد بِن مُوسَى اَلْخْوَارِزْمِي (in English Al-Khawarizmi), who introduced in Middle East then in Europe the so-called arabic numerals.
Also, word algebra is taken from part of the Arabic title of his best known book. PS Now I'm sure NSA is watching me ;) |
Quote:
Now all I have to do is get permission... |
Quote:
Thanks for input. |
The problem intrigued me - so I wrote a li'l c-program you can run from the command line ... so be my guest!
https://dl.dropboxusercontent.com/u/...19/roman2bin.c Sadly, it doesn't do a reverse conversion :-( |
Quote:
Code:
IDENTIFICATION DIVISION. Enjoy! :D |
Seems to be an age-appropriate solution. :)
|
Here's a PyQt app I just knocked up. It needs the roman Python package to be installed.
Code:
#!/usr/bin/env python |
Quote:
As an aside, after I posted this I thought "Gee, that should really display NUMERAL, not NUMBER"... so I edited the post. Then I got a nagging feeling that I'd better compile the edited program just in case, and sure enough it no longer compiled. It output "roman.cob:34 Error, syntax error, unexpected NO, expecting "NO ADVANCING"". By default, COBOL uses fixed format. This is based on punch card columns. Although I'd kept everything within 80 columns, for some unknown reason columns 73 - 80 are ignored by the compiler. This can be worked around by passing -free to the compiler, which lifts all the column restrictions (and I'd be surprised if this wasn't done for all COBOL that's developed these days... but I guess you never know). I'm remembering why I hate COBOL. Sorry I brought it up. |
At least you didn't do it in Perl, which I consider to be the Devil's flatus.
|
Quote:
|
Quote:
Turns out http://www.novaroma.org/via_romana/numbers.html... um, goes both ways -- type in 1854 you get MDCCCLIV, type in MDCCCLIV you get 1854 (or, for that matter, type in mdcccliv and you get 1854). Exactly what's needed. And exactly what click-'n'-drool users like (Terminal window! We don't need no stinkin' terminal window! -- with due apologies to The Treasure of Sierra Madre). I remember writing a fair rounding function, in BASIC, sometime in the mid 70's on a Honeywell mainframe (GECOS and all that). An actual BASIC compiler, not an interpreter, and it actually worked (which surprised the heck of me) Then had to turn around and write the same thing in FORTRAN IV (see, Roman numerals!). Thankfully, C has that built-in. Whatsit, the American Society of Testing and Materials Engineers, the ASTM method, if the digit next beyond the digit to be retained... lordy. Thanks for the blast from the past, appreciate it -- didn't try it (yet) but appreciate it. |
What did the Romans ever do for us?
|
Quote:
|
All times are GMT -5. The time now is 07:09 PM. |