Re: [css-counter-styles] Algorithm of 'symbolic' is incorrect

On Mon, Feb 24, 2014 at 2:28 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
> On Tue, Feb 25, 2014 at 8:44 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Sun, Feb 23, 2014 at 12:52 AM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
>>> Hi,
>>>
>>> In the current draft, the algorithm of system 'symbolic' seems to be
>>> incorrect. We use the style "footnote" defined in the spec for
>>> example:
>>>
>>> Let counter value = 1, N = 4, then
>>>
>>> 1. chosen symbol = symbol(1 mod 4) = symbol(1) = ⁑ (SHOULD be '*')
>>> 2. representation length = floor( (1 - 1) / 4 ) = 0 (SHOULD be 1)
>>> 3. S = representation length * chosen symbol = (empty sequence)
>>>
>>> The correct algorithm should be:
>>>
>>> Let N be the length of the list of counter symbols, value be the
>>> counter value, S initially be the empty string, and symbol(n) be the
>>> nth counter symbol in the list of counter symbols (0-indexed).
>>>
>>> 1. Let the chosen symbol be symbol( (value - 1) mod N).
>>> 2. Let the representation length be ceil(value / N).
>>> 3. Append the chosen symbol to S a number of times equal to the
>>> representation length.
>>>
>>> Finally, return S.
>>
>> Oh jeez, how did I get this so wrong?  That's embarrassing. ;_;
>>
>> Fixed, thanks.
>
> I found that you just fixed one error, however there were two. See the
> second step, which should be `ceil(value / N)` instead of
> `floor((value - 1) / N)`.

I fixed that in the following commit.

~TJ

Received on Monday, 24 February 2014 23:28:31 UTC