Varun Sharma

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromVarun Sharma
ToMe
SubjectArabic To Roman Calculator
Date8 May 2009 12:38
AttachmentScreenshot of optimised conversion
Hi,

There is a mistake in your arabic to roman calculator. The correct
conversion of 3957 to roman is MMMCMLVII and not MMM*LM*VII (see the
attachment). This is because according to the laws, we can only have C or D
before M and not L (as shown by your conversion). Can you please look into
this and correct the algorithm ? You can yourself confirm it by trying other
websites.

Thanks

Varun
FromMe
ToVarun Sharma
SubjectRe: Arabic To Roman Calculator
Date9 May 2009 08:09
Varun,

> There is a mistake in your arabic to roman calculator.

It's not a mistake. The script can produce either traditional or
optimised numerals. It is an optional optimisation, that can be disabled
by passing 'true' as the second parameter to the ArabicToRoman function
(available since version 1.1, released in November 2003). See the source
of the script for more details:
http://www.howtocreate.co.uk/php/dnld.php?file=2&action=1
as well as this email thread from back when I implemented it:
http://www.howtocreate.co.uk/emails/DustinKincaid.html

I have now updated the demo so it will output both versions in the event
that they would be different.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromVarun Sharma
ToMe
SubjectRe: Arabic To Roman Calculator
Date9 May 2009 08:21
Hi,

Oh sorry mate ! my fault then ! I actually thought there is only one way to
convert from arabic to roman.

Varun
FromMe
ToVarun Sharma
SubjectRe: Arabic To Roman Calculator
Date9 May 2009 09:31
Varun,

> I actually thought there is only one way to
> convert from arabic to roman.

There are actually a large number of formats that can be used for the same
number, and it's only relatively recently that one of the traditional
approaches has become the "standard".

IIII vs IV (used to avoid confusion with the abbreviated form of the name
IVPPITER).
MDCCCCX vs MCMX.
IIIII vs V.
IIX vs VIII.
VV vs X.

In very early cases, the subtractive principle was not used, so XIV and XVI
were the same number, even though normally, they would now be different.

These have all been used at various times, and treated as correct, which
must make it more difficult when finding an artifact, not knowing what
numbers it really represents. Normally, however, only a single lower value
character may appear before a higher value character (meaning IIX is not
accepted). This is one principle the script always enforces.

Likewise, it is normal that only characters I X C M (10^n, but not 5*10^n)
can appear in front of a higher value character (so VC is not allowed), and
that character can only appear in front of a character with value 10^n+1 (so
IX is allowed but IC is not). However the subtractive principle would in
theory allow these optimisations, and the script allows them to be either
enabled or disabled, based on which option you choose. It's not a "normal"
output to allow them, but the principle works.

One of these days, I should make it work with fractions as well...


Tarquin
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.