Re: RE: [PEAR] [ANNOUNCEMENT] Numbers_Words-0.7.1 (beta) Released.

From: Date: Tue, 25 May 2004 15:23:11 +0000
Subject: Re: RE: [PEAR] [ANNOUNCEMENT] Numbers_Words-0.7.1 (beta) Released.
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-29645@lists.php.net to get a copy of this message
Antonio Carlos Venancio Junior wrote:
David, David Costa wrote:
On May 25, 2004, at 4:27 PM, Antonio Carlos Venancio Junior wrote:
    Yeah, i think it _is_ a problem. You have to parse the number and raise an error when the conversion could not be made, i.e. because the user passed a "bad" roman number.
    Try to remember when you have learned semanthics (and roman numbers too). You need to understand that 'VIIII' _is not_ the representation of the number nine (9). The correct representation is 'IX'. You will never find a book with page 'VIIII', gotcha?!
Get a life. This it totally absurd argumentation. Personal attacks really don't have a place on this list. Try googling VIIII and don't forget to read the links I gave in my last email.
You think, well first and foremost this is a BETA package. So I can change the API if needed and if I deem it appropriate. Second YOU need to understand that if you pass an invalid numeral you will get an odd/inaccurate result. Nobody can forecast all the possible numerals passed from 1 to 5999999 so if the use doesn't bother to learn how to use a package don't blame the author.
    Yes, you _can_. Roman number representation follow some simple rules (regular expressions ...). The following are some general rules for constructing Roman numerals:
----------- - Characters are additive. I is 1, II is 2, and III is 3. VI is 6 (literally, “5 and 1”), VII is 7, and VIII is 8. - The tens characters (I, X, C, and M) can be repeated up to three times. At 4, you need to subtract from the next highest fives character. You can't represent 4 as IIII; instead, it is represented as IV (“1 less than 5”). The number 40 is written as XL (10 less than 50), 41 as XLI, 42 as XLII, 43 as XLIII, and then 44 as XLIV (10 less than 50, then 1 less than 5). - Similarly, at 9, you need to subtract from the next highest tens character: 8 is VIII, but 9 is IX (1 less than 10), not VIIII (since the I character can not be repeated four times). The number 90 is XC, 900 is CM. - The fives characters can not be repeated. The number 10 is always represented as X, never as VV. The number 100 is always C, never LL. - Roman numerals are always written highest to lowest, and read left to right, so the order the of characters matters very much. DC is 600; CD is a completely different number (400, 100 less than 500). CI is 101; IC is not even a valid Roman numeral (because you can't subtract 1 directly from 100; you would need to write it as XCIX, for 10 less than 100, then 1 less than 10). ----------
It would be nice to perhaps raise some errors if really dumb stuff is entered (like XV). However, you need to realize that the Romans didn't have rules like we do today. Much of what you're saying only applies to modern numerals. Not to ancient stuff. I'm not sure that you wouldn't find VV, LL in ancient writings and inscriptions. Note: I took a class on Ancient Latin -- we studied the development of Latin on the basis of the earliest inscriptions up to Classical Latin. You'd be surprised at the sort of stuff you find on there. And for the less educated, I'm 100% sure that it was easier to write LXXXXIIII than XLIV, for the final reason you mention (ascending value from left to right). It doesn't require a doctorate in the history of numerical depiction to see that.
    So do you remember that there is no representation for zero (0), for example. The numbers goes from 1 to 3999 (including them).
    I'm warning you aobut that now about that and asking you to change it. If you are in doubt please try to search the web for the rules to represent roman numbers. The rules above are a very good start. If you follow them the code will be faster.
Forget about the rules! You've got some really wierd stuff out there! Usage is what determines what is correct or not -- at least from the conversion point of view. Please don't forget that. If you think the rule of up to three repetitions of 'I', 'X', 'C' is relegated to ancient times, please note that the German army in WWII had a LXXXX corps: http://home.hetnet.nl/~conny-rene/Korpsen/LXXXX%20AK.htm Klaus

« previous php.pear.dev (#29645) next »