## Roman Numeral Converter

- Thursday, May 10 2012 @ 09:24 AM EDT
- Contributed by: masodo
- Views: 6,480

*Click " Read More" for the script ==>*

## A great many people arrive on this page looking for information on how to handle large number values with Roman Numerals. This converter can only convert up to 3,999,999 because of conventional rules. However, you may find the following information useful.

## Large Roman NumeralsDate: 08/15/97 at 10:52:53 From: Eppie Subject: Roman numerals Could you please convert 5000, 1,000,000, and 5,000,000 into Roman numerals? Date: 08/22/97 at 11:35:14 From: Doctor Cheryl Subject: Re: Roman numerals I had to look for a while to find the information I remembered about how to write really large numbers in Roman numerals. According to an old 1960 mathematics textbook called "Mathematics second course" by Brown, Gordey, Sward and Mayor, the Roman numeral system worked like this: I = 1, V = 5, L = 50, C = 100 and M = 1000. If a heavy bar was placed over the numeral that meant it was multiplied by 1000. A V with a bar over it would stand for 5000. An M with a bar would be 1,000,000. How would YOU write your last numeral: 5,000,000? For more about Egyptian and Roman Numerals, see the Math Forum Internet News for 27 October, 1997: http://mathforum.org/electronic.newsletter/ and see the Dr. Math FAQ: Roman Numerals http://mathforum.org/dr.math/faq/faq.roman.html -Doctors Cheryl and Sarah, The Math Forum Check out our web site! http://mathforum.org/dr.math/ Date: 02/28/2006 at 04:12:25 From: Arnold Subject: Roman Numerals How do you write a decimal number higher than 4,000,000? I found it to be interesting that the rules state that you can only use a particular letter 3 times max (if I'm not mistaken). Therefore if I use MMMM with a bar on top to signify 4,000,000, it would break the 3 letter max rule. The other way I can think of is to use two bars but would that be right? Date: 02/28/2006 at 09:57:02 From: Doctor Peterson Subject: Re: Roman Numerals Hi, Arnold. The basic answer is that the Romans rarely bothered to write such large numbers, so they never developed a convenient way to do it, just several ad-hoc tricks to extend the system a bit. One is the bar (though I think that was a later addition); another earlier trick was to put what we might call parentheses around a number to multiply it by 1000. That is, something like (|) was an early form of M=1000, and they would use ((|)) for 1,000,000 and so on. I don't know whether using double bars is considered valid, either in the sense of having been used historically, or of being commonly accepted today. But it makes sense, and I know some people use it when needed. The 3-times rule is not really a rule, and was not followed by the Romans themselves, who often write IIII for 4. The "rule" just arises from the fact that, once the subtraction rule was developed, it was not _necessary_ to use more than 3 of anything. When you get up to MMMM, there is no alternative, so the rule does not really apply; it _is_ necessary to repeat four or more times, if you choose not to use the bar. So my answer to your question would be _____ MMMMM = 5,000,000 and I wouldn't be bothered by == IV Here is one discussion of the details I've mentioned: Roman Numerals - How They Work http://www.web40571.clarahost.co.uk/roman/howtheywork.htm#larger Look higher on the page for some examples of how the Romans broke the modern "rules". If you have any further questions, feel free to write back. - Doctor Peterson, The Math Forum Check out our web site! http://mathforum.org/dr.math/ |

```
<script type="text/javascript">
function convert() {
var inputNum = document.formConvert.inputNumber.value;
var arabicVal, romanVal;
switch ( convertType(inputNum) ) {
case 'RtoA':
arabicVal = RtoA(inputNum);
if(arabicVal != -1){
romanVal = AtoR(arabicVal);
}
else {
alert(inputNum +": invalid roman numeral.");
arabicVal = ''; romanVal = ''; inputNum.value = '';
}
break;
case 'AtoR':
arabicVal = inputNum;
romanVal = AtoR(arabicVal);
break;
default:
arabicVal = ''; romanVal = ''; inputNum.value = '';
return false;
}
document.formConvert.romanNumber.value = romanVal;
document.formConvert.arabicNumber.value = arabicVal;
}
function AtoR(arabic){
if (arabic > 3999999 || arabic < 1){
return 'Expect number from 1 to 3,999,999';
}
var r_nums = getRnums();
var a_nums = getAnums();
var remainder = parseInt(arabic);
var roman = '', count = 0;
var len=r_nums.length;
for ( var i=1; i<len; ++i ){
while(remainder >= parseInt(a_nums[i]) ){
if((count++) > 30) return -1;
roman = roman + r_nums[i];
remainder = remainder - a_nums[i];
}
if(remainder <= 0)break;
}
return roman;
}
function RtoA(roman){
var r_nums = getRnums();
var a_nums = getAnums();
var remainder = roman.replace(/i/g, "M");
var arabic = 0, count = 0, test = remainder;
var len=r_nums.length;
for ( var i=1; i<len; ++i ){
var numchrs = r_nums[i].length;
while( remainder.substr(0,numchrs) === r_nums[i]){
if((count++) > 30) return -1;
arabic += a_nums[i];
remainder = remainder.substr(numchrs,remainder.length-numchrs);
}
if(remainder.length <= 0) break;
}
if(remainder.length !==0 ){
alert(roman + " INVALID truncating to "+test.replace(remainder,'') );
}
if( (0 < arabic) && (arabic < 4000000) )return arabic;
else return -1;
}
function convertType(inputNum) {
if (inputNum.match("^([IVXLCDMivxlcdm]+)$")) {
if (inputNum.length <= 27) {
return 'RtoA';
} else {
alert(inputNum + " cannot be converted");
return -1;
}
} else if (inputNum.match("^([0-9]+)$")) {
var inputInt = parseInt(inputNum);
if ((inputNum > 0) && (inputNum < 4000000)) {
return "AtoR";
} else {
alert(inputNum + " out of range - must be from 1 to 3,999,999");
return -1;
}
} else {
alert(inputNum + " cannot be converted");
return -1;
}
}
function getRnums() {
var r_nums = Array();
r_nums[1] = 'm';
r_nums[2] = 'cm';
r_nums[3] = 'd';
r_nums[4] = 'cd';
r_nums[5] = 'c';
r_nums[6] = 'xc';
r_nums[7] = 'l';
r_nums[8] = 'xl';
r_nums[9] = 'x';
r_nums[10] = 'Mx';
r_nums[11] = 'v';
r_nums[12] = 'Mv';
r_nums[13] = 'M';
r_nums[14] = 'CM';
r_nums[15] = 'D';
r_nums[16] = 'CD';
r_nums[17] = 'C';
r_nums[18] = 'XC';
r_nums[19] = 'L';
r_nums[20] = 'XL';
r_nums[21] = 'X';
r_nums[22] = 'IX';
r_nums[23] = 'V';
r_nums[24] = 'IV';
r_nums[25] = 'I';
return r_nums;
}
function getAnums() {
var a_nums = Array();
a_nums[1] = 1000000;
a_nums[2] = 900000;
a_nums[3] = 500000;
a_nums[4] = 400000;
a_nums[5] = 100000;
a_nums[6] = 90000;
a_nums[7] = 50000;
a_nums[8] = 40000;
a_nums[9] = 10000;
a_nums[10] = 9000;
a_nums[11] = 5000;
a_nums[12] = 4000;
a_nums[13] = 1000;
a_nums[14] = 900;
a_nums[15] = 500;
a_nums[16] = 400;
a_nums[17] = 100;
a_nums[18] = 90;
a_nums[19] = 50;
a_nums[20] = 40;
a_nums[21] = 10;
a_nums[22] = 9;
a_nums[23] = 5;
a_nums[24] = 4;
a_nums[25] = 1;
return a_nums;
}
</script>
```

** Thank you for visiting BlogDogIt** - *Please have a look around...*

There is Lots and Lots of interesting stuff on this site.

*Also be sure to* **Visit our friends via those links on the right → **