[fpc-pascal] Re: StrUtils.RomanToInt oddities

Bart bartjunk64 at gmail.com
Mon Sep 23 22:28:58 CEST 2013


On 9/23/13, Frederic Da Vitoria <davitofrg at gmail.com> wrote:

> What about making an option of it?

It's up to the fpc devels.

> Anyhow, if the function accepts invalid combinations, what should it
> return? For some, the answer would be obvious (IIII), but some combinations
> are indeed ambiguous (IIIIM) So that we maybe could accept unambiguous
> invalid combinations, but I don't see how to accept ambiguous ones.

If it accepts, then it should apply the subtraction rule: only the
(one) numeral left to the other (bigger one) can be subtracted.
So IIIM would be III + IM = 3 + 1000-1 = 1002 (and not 1000-3 = 997)
There should be no ambiguity there, it's only a pain to watch it.

Bart



More information about the fpc-pascal mailing list