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

Re: Exponents in <number>

From: Bert Bos <bert@w3.org>
Date: Sat, 06 Sep 2008 12:38:15 +0200
Message-ID: <48C25D97.4030700@w3.org>
To: www-style@w3.org

Dean Jackson wrote:

> 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.

The reasons were, roughly in order of decreasing importance:

   - 9 out of 10 users wouldn't understand them.

   - TeX doesn't need them, so why should CSS?

   - If there is a need for printing on a piece of paper that is 1km
     long, we can always add 'km' as a unit.

   - E-notation makes parsing more difficult.

Changing it would be difficult. Existing software is free to rewrite 
"100E+5" as "100e + 5" and "1.4E+1cm" as "1.4e + 1cm". And if some 
hypothetical new software rewrites 100 as 1E+2, then old programs will 
not understand the supposedly equivalent value anymore.

It's true that we'll have part of the same problem when we add calc(), 
because calc(5px) is supposed to be the same as 5px, but at least calc() 
adds functionality that didn't exist before, while E-notation is just 
syntactic sugar.

> 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.

CSS actually doesn't need a lot of range or accuracy. Typical sizes in 
CSS range from half a pt to a couple of cm. That's a ratio of 1:10000 or 
  about 15 bits. And as for accuracy, the wavelength of light is about 
0.001 pt, so smaller sizes than that are invisible anyway. Those limits 
aren't based on limits in technology, but on limits in people, and they 
aren't likely to change for the next 100,000 years.

For comparison, TeX uses 32-bit fixed point numbers that allow it to 
express sizes from as small as about 5 nm to as large as about 6 m. In 
other words: from 1/100 the wavelength of light to 5 times the height of 
an A0 sheet of paper.

TeX dates from 1982. I expect CSS implementations to do no worse than a 
program that's 25 years old and so well known. But there is really no 
need to do better, either.

I haven't seen a case where m or Ám were needed, let alone even bigger 
or smaller units. Still, the syntax allows adding them if really needed.

For Hz and deg, big and small numbers are even more unlikely.

   Bert Bos                                ( W 3 C ) http://www.w3.org/
   http://www.w3.org/people/bos                               W3C/ERCIM
   bert@w3.org                             2004 Rt des Lucioles / BP 93
   +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Saturday, 6 September 2008 10:39:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:39 UTC