W3C home > Mailing lists > Public > www-style@w3.org > September 2008

Re: Exponents in <number>

From: Dean Jackson <dino@grorg.org>
Date: Sat, 6 Sep 2008 11:26:11 +1000
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>
Message-Id: <14AEAC6C-58A5-4EB3-B9E9-8BB747084061@grorg.org>
To: www-style@w3.org


On 06/09/2008, at 7:42 AM, Dean Jackson wrote:

>
> On 06/09/2008, at 6:49 AM, Tab Atkins Jr. wrote:
>
>> On Fri, Sep 5, 2008 at 3:43 PM, Dean Jackson <dino@apple.com> wrote:
>>
>> According to CSS 3 Values and Units, numbers can't be of the form  
>> 1.0e20.
>>
>> http://www.w3.org/TR/css3-values/#numbers
>>
>> "A <number> can either be an <integer>, or it can be zero or more  
>> digits followed by a dot (.) followed by one or more digits."
>>
>> Was there a reason for not allowing this?
>>
>> Would it be possible to change the syntax to allow the format? (I  
>> assume this would be classified as a significant change)
>>
>> I'm curious - do you have *any* use-cases for a number that can't  
>> be plainly stated without exponents?
>
> As tempting as it is to sit around all day reading specifications  
> and looking for inconsistencies, I actually did come across this in  
> real content. In this case is was for implementing getComputedStyle.
>
> Of course, this doesn't mean plainly stating the number is  
> impossible. I just think that exponents are more user friendly than  
> something like 0.000000000000001234.

Another reason to allow this is that most implementors will use printf- 
type library methods to convert floating point numbers for output as  
strings. In these cases they'll want to control the number of  
significant digits displayed and only exponential notation allows such  
control for very big or small numbers.

We suspect this is why some browsers have actually implemented  
exponential notation even though the specification doesn't allow it  
(and, in the WebKit case for example, breaks round-tripping of  
computed style at them moment).

Dean
Received on Saturday, 6 September 2008 01:26:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:12 GMT