Oh, wow. Sorry, but I don't see this happening any time soon.

Here's just a few problems:

- Roman numerals are hardly ever used.
- `0` does not have a standard representation.
- Fraction representation is possible, but relatively complicated.
- The set of characters used for Roman numerals is non-standard. It varied 
over time and even geographically.
- Often times, there are multiple representations for one and the same number
- Fore more problems, see below.

Contrary to popular belief, Roman numerals do **not** just consist of a bunch 
of (non-standard) letters that represent numeric values. In fact, there were 
different kinds of dots (uncia, sextans, …) that represented values in a 
duodecimal fraction system as well.

Romans even started drawing lines around their numbers to indicate that the 
value of the represented numeral is multiplied or raised by some constant; 
look up "Vinculum". This was used to represent larger numbers.

Another thing that was used for larger numbers was the "Apostrophus", which 
was an encasing system to indicate that the encased part is multiplied by a 
constant. How would you handle that, and how would you treat the optional 
contractions? ("C|Ɔ" → "ↀ", "|ƆƆ" → "ↁ", etc.)

Suffice it to say that this doesn't fit into `parseInt`/`toString(n)` at all, 
as 
Roman numerals are a **nonpositional** numeral system. Therefore, it doesn't 
make sense to supply a radix.

This kind of functionality is best kept in libraries.

On Thursday, July 6, 2017 6:13:08 PM CEST Owen Swerkstrom wrote:
> This started as a joke, but after implementing it, I'd actually like
> to propose this as an addition and see what comes of it.
> 
> I've added support for stringifying and parsing numbers to and from
> Roman numeral representation, using the usual Number functions:
>     var num = 5;
>     console.log(num.toString("r")); // logs "V"
>     console.log(parseInt("IX"));    // logs 9
> https://github.com/penduin/romanumber
> 
> I have two main questions:
> - Is this worth proposing?  It seems silly, but does deal with real
> numerical representations.
> - Is using "r" as a radix sane?  Would separate .toRomanString /
> .parseRoman be better?
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to