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

Re: Exponents in <number>

From: Dean Jackson <dino@apple.com>
Date: Sat, 6 Sep 2008 07:42:42 +1000
Cc: www-style@w3.org
Message-Id: <5AE74A93-8036-4D91-AD2A-86A5DA18841D@apple.com>
To: Tab Atkins Jr. <jackalmage@gmail.com>

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.

> I suspect "there's absolutely no need for it" was the reason for not  
> allowing it.


I suspect that this restriction in CSS was not intentional. However,  
if it was intentional then I think "absolutely no need for it" was the  
wrong reason. There was "absolutely no need" for more than 640K of RAM.

Large or small numbers can happen, especially when you nest things and  
the scale accumulates. Accuracy matters. With features like page zoom,  
transformations and resolution-independent displays it's going to  
become more common.

Two more notes: firstly, SVG allows numbers with exponents. Secondly,  
some browsers actually return numbers in exponential format.

Dean
Received on Friday, 5 September 2008 21:43:24 GMT

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