W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Re: List Of Numbers Produces Incorrect Output (part of detailed review of common microsyntaxes)

From: Geoffrey Sneddon <foolistbar@googlemail.com>
Date: Mon, 2 Jun 2008 14:30:19 +0100
Cc: public-html@w3.org
Message-Id: <D1C987B9-E8F8-4111-BD05-EA0838744FBB@googlemail.com>
To: Ian Hickson <ian@hixie.ch>


On 8 May 2008, at 07:07, Ian Hickson wrote:

> On Wed, 11 Jul 2007, Geoffrey Sneddon wrote:
>>
>> Passing #lists a string of "10" results in a list with a single  
>> value:
>> 1. This (almost certain) bug is caused by substeps 24 of the number
>> character option within step 13 (parser). At the second digit, we
>> multiple 0*10 before adding it to value. However, if we rewrite  
>> this set
>> of substeps to follow the pattern used in the algorithms above  
>> (such as
>> real numbers) the said bug can be fixed:
>>
>> [[
>> 1. If finished is true, skip to the next step in the overall set of  
>> steps.
>>
>> 2. Multiply value by ten.
>>
>> 3. Add the value of the digit, interpreted in base ten, to value.
>>
>> 4. Let started be true.
>> ]]
>>
>> This removes the need for two variables (multiple and n). Therefore,
>> step 9 of the outer algorithm also needs to be removed.
>
> Er, yeah, I don't know what I was thinking about when I was writing  
> that
> part of the algorithm, but it clearly wasn't maths. Fixed.

Here, for your interest, is a table of the changes those two commits  
made in my test cases:

+-----------+---------------+---------------+
|   Input   |   Old List    |   New List    |
+-----------+---------------+---------------+
|    .1     |   []          |   [1]         |
|    -.1    |   []          |   [1]         |
|    -10    |   [-1]        |   [-10]       |
|    - 1    |   [0, 1]      |   []          |
|    - 1.1  |   [0, 1]      |   []          |
|    1 .1   |   [1]         |   [1, 1]      |
|    1. 1   |   [1, 1]      |   [1]         |
|    -.     |   [0]         |   []          |
+-----------+---------------+---------------+


--
Geoffrey Sneddon
<http://gsnedders.com/>
Received on Monday, 2 June 2008 13:30:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:18 GMT