This calculator can be used to convert a number from the decimal system to a Roman numeral or a Roman numeral to a number in the decimal system.

## Structure of a Roman numeral

character | I | V | X | L | C | D | M |
---|---|---|---|---|---|---|---|

value | 1 | 5 | 10 | 50 | 100 | 500 | 1000 |

Roman numerals are represented with the help of the letters I, V, X, L, C, D and M. Each of these letters has a specific value. For example, I has the value 1 and V has the value 5.

The characters of a roman number are sorted in descending order according to their value (exception: subtractive notation). For example, XVII is a valid Roman numeral, but IIXV is not.

A character whose value starts with a 1 (I, X, C and M) can be placed up to 3 times in a row. A character that starts with a 5 (V, L and D) may not be repeated. VV is not valid, for example. Instead, X would be written.

If the subtractive notation was not used for a Roman numeral, then the Roman numeral is equal to the sum of the values of all the characters used.

Examples:

VIII | → | 5 + 1 + 1 + 1 = 8 |

CCXI | → | 100 + 100 + 10 + 1 = 211 |

XVII | → | 10 + 5 + 1 + 1 = 17 |

MDV | → | 1000 + 500 + 5 = 1505 |

LXXXI | → | 50 + 10 + 10 + 10 + 1 = 81 |

### Subtractive notation:

With the help of the subtractive notation, numbers can be represented as Roman numerals that contain a 4 or a 9. Normally, the characters of a Roman numeral are sorted from left to right in descending order by value. When using the subtractive notation, a character whose value starts with a 1 (I, X or C) may be followed by one of the next two characters in the table with a higher value. Thus, an I may be followed by either a V or an X. An X may be followed by an L or a C and a C may be followed by a D or an M. However, only one smaller character may precede a character. IX is therefore okay, but IIX is not.

In such a 2-character combination, where the front character has a smaller value than the back character, the value of the front character is subtracted from the value of the back character.

Examples:

IX | → | 10 - 1 = 9 |

IV | → | 5 - 1 = 4 |

CM | → | 1000 - 100 = 900 |

XL | → | 50 - 10 = 40 |

XIX | → | 10 + (10 - 1) = 19 |

## Convert roman number to number in decimal system

To convert a Roman numeral to a number in the decimal system, it is recommended to first search the number occurances of the use of the substractive notation. Then you sum the values of all characters that do not belong to a "2-character-substraction-combination" and the values of all "2-character-substraction-combination". If there are several identical characters in a row, they can be combined into one summand.

Example:

The Roman numeral is: MCDLXXIX

The value of C is smaller than the value of D and the value of I is smaller than the value of X. Thus, both CD and IX use the substractive notation.

MCDLXXIX

Next, the characters and the two "2 character combinations" are converted to numbers and the sum is formed:

1000 + 400 + 50 + 20 + 9 = 1479

## Convert numbers to Roman numerals

To convert a number to a Roman numeral, you can first split the number into a sum so that for every digit (not equal to 0) in the number, there is a summand in the sum.

For example, 108 is split into the sum 100 + 8. And 3194 is written as 3000 + 100 + 90 + 4.

Then each summand is converted to a Roman numeral and the results are concatenated.

Example:

The number 2947 is to be converted into a Roman numeral.

First, the number is split into a sum:

2947 = 2000 + 900 + 40 + 7

Then each of the 4 summands is converted into a roman numeral:

2000 | → | MM |

900 | → | CM |

40 | → | XL |

7 | → | VII |

The result is: MMCMXLVII

The following tables may be helpful in converting to Roman numerals.

value | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|

Roman numeral | I | II | III | IV | V | VI | VII | VIII | IX |

value | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 |
---|---|---|---|---|---|---|---|---|---|

Roman numeral | X | XX | XXX | XL | L | LX | LXX | LXXX | XC |

value | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
---|---|---|---|---|---|---|---|---|---|

Roman numeral | C | CC | CCC | CD | D | DC | DCC | DCCC | CM |

value | 1000 | 2000 | 3000 |
---|---|---|---|

Roman numeral | M | MM | MMM |