A friend commented, "Can you imagine doing math with Roman Numerals? Ewwwwww." I got to thinking, how hard was it for those Roman kids?
There's a nice explanation over at Wikipedia, but here's a quick reminder:
I | 1 |
V | 5 |
X | 10 |
L | 50 |
C | 100 |
D | 500 |
M | 1000 |
Trivia: The largest number you can represent in Roman numerals is 3999 (MMMCMXCIX)
Here's a simple converter.
Converting questionably legal Roman numbers may not work as expected. For example, XM returns 1010 because X should only precede L or C to subtract 10, though some people might interpret it as 990. But that's not the way I roll. 990 shall always be CMXC.
It's pretty easy to add Roman numerals: I + II = III. And II + III = IIIII = V. Going bigger the trick is to break it down into thousands, hundreds, tens and ones. You even carry to the next place like you do with Arabic numbers: V + V = X, carried forward into the tens place.
Thousands | Hundreds | Tens | Ones | |
+ | ||||
= |
Subtraction works just like adding, though there are a few caveats since there aren't negative Roman numbers. But you borrow from the next place just like with Arabic numbers, it's just that "place" and "digit" aren't interchangeable anymore.
Thousands | Hundreds | Tens | Ones | |
− | ||||
= |
I presume the Romans must have figured out the multiplication table…
Though it must have been tedious practice. "IV times VII equals XXVIII. IV times VIII equals XXXII…"
Once you know your multiplication table, and divide the number up in ones, tens, hundreds and thousands you can do long multiplication just like you do with Arabic numbers. You know, that thing where shift things one column over and add up the sub-products. Except instead of being one digit per column you just do it by ones, tens, etc..
Thousands | Hundreds | Tens | Ones | |
× | ||||
Ones sub-product | ||||
Tens sub-product | ||||
Hundreds sub-product | ||||
Thousands sub-product | ||||
= |
I presume long division would work the same, but my head is beginning to hurt. I'll just include the calculator. There are no Roman decimals, but there are Roman base-12 fractions. You can't enter fractions but as long as the result comes out to a base-12 fraction you'll get the correct result.
Thousands | Hundreds | Tens | Ones | Fraction | |
÷ | |||||
= |
Copyright 2012 Rick Kaseguma. All Rights Reserved.
This page is HTML, CSS, Javascript and jquery, running entirely in your browser. Feel free to View Source and see how it works. I think it turned out pretty well for a quick part-of-a-day project.