http://www.perlmonks.org?node_id=1085825


in reply to At the risk of saying something stupid-but-obvious about Roman Numerals

sundialsvc4,
Something seems fishy with your code.
my $roman = "MCCMLXXIV"; #1874
Shouldn't that be MDCCCLXXIV? I am pretty sure what you have isn't valid.

Cheers - L~R

  • Comment on Re: At the risk of saying something stupid-but-obvious about Roman Numerals
  • Download Code

Replies are listed 'Best First'.
Re^2: At the risk of saying something stupid-but-obvious about Roman Numerals
by Anonymous Monk on May 12, 2014 at 23:28 UTC

    Or even, MDCCCLXXIIII. Romans probably treated the numbers like a bag of coins. To add two numbers, just lump them together. Substractive forms (IV, IX, XL, XC, CD, CM), and even double substractives (such as CCM) would also occur, according to wikipedia.