Re: Spreadsheet column labels as base-26 numbers

I agree, the lack of a zero in the spreadsheet example creates a disjunct
with a true hexavigesimal system. Either (1) special preprocessing would
need to treat "Z" as "A⓪" and do any necessary addition or (2) treat A as
zero, do a base-26 translate, and add 1 to the final result of
parse-integer().

The original example that came to mind was of filename extensions. Back
when the filename was allowed only 8 characters, the extensions could be
used to group and order related files (e.g., pages in a single
publication). A decimal system gets one up to 999. For larger groups, the
hexavigesimal system can be used (and still is, in my workplace). It's a
boutique numeration method that can have the unwanted side effect of making
*.com and *.exe files.

Joel

On Tue, Apr 25, 2023 at 5:31 PM Reece Dunn <msclrhd@googlemail.com> wrote:

> On Tue, 25 Apr 2023 at 21:29, Michael Kay <mike@saxonica.com> wrote:
>
>> It was suggested during the meeting that spreadsheet column labels can be
>> interpreted as base-26 numbers.
>>
>> I can't immediately see how this is supposed to work.
>>
>> The typical sequence is A, B, C, ... Z, AA, AB, AC, ...
>>
>> What is the zero-digit here? It can't be A, because then A would be 0 and
>> AA would also be 0.
>>
>
> In spreadsheets (Excel, LibreOffice Calc, etc.) the first cell A1 is the
> coordinates (1, 1). -- That is, there is no 0 digit.
>
>
>> If A=1, with radix=27, then Z=26 and AA=28 so there is a gap in the
>> sequence.
>>
>> While the sequence is logical and practical, I can't see any way to
>> interpret the column label as a base-N number.
>>
>
> In https://www.w3.org/TR/css-counter-styles-3/, that defines several
> algorithms for formatting numbers. These include:
>
> 1. Alphabetic (
> https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system) e.g.
> upper-alpha -- These don't have a defined symbol for "0". The algorithm
> performs a `value = value - 1` at each step in the loop.
>
> 2. Numeric (https://www.w3.org/TR/css-counter-styles-3/#numeric-system)
> e.g. decimal -- These have a defined symbol for "0". The algorithm works
> like the alphabetic algorithm, but has a special case when the value is
> "0", and does not subtract 1 from value at each step.
>
> 3. Additive (https://www.w3.org/TR/css-counter-styles-3/#additive-system)
> e.g. armenian, lower-roman -- These are specified as a map of (symbol,
> value) pairs. Note that in the roman numerals case, it defines symbols for
> the subtractive case (e.g. `map { 5: "v", 4: "iv", 1: "i" }`).
>
> There are several other systems, but I don't think those are relevant to
> parsing number formats. The specification defines a range of number formats
> from different languages (see
> https://www.w3.org/TR/css-counter-styles-3/#simple-numeric and
> https://www.w3.org/TR/css-counter-styles-3/#complex-predefined-counters).
>
> Kind regards,
> Reece
>
>
>> Michael Kay
>> Saxonica
>>
>>
>>
>>
>>
>>
>>

-- 
Joel Kalvesmaki
kalvesmaki.com

Received on Wednesday, 26 April 2023 04:53:27 UTC