[css3-values][css3-syntax] E notation, very small and very large values

Håkon Wium Lie:
> 
> I don't want to see this in style sheet:
> 
>  h1 { font-size: 2.6e-4em }

Uch, it really looks like 2.6 e minus 4 em. And who says we wouldn’t want to introduce Euler’s constant as a pseudo-unit at some point in the future?

> If we need very small numbers in some properties, I'm sure there are better solutions.

There certainly are, appropriate units usually, and functions perhaps.

  h1 {font-size: calc(2.6em / 10000)}
  h1 {font-size: frac(2.6em, 10000)}
  h1 {font-size: sci(2.6em, -4)} /* scientific  x*10^y  */
  h1 {font-size: eng(260em, -2)} /* engineering x*10^3y */

If we were using percentages for values that can range from 0 to 1, we could do away with lots of decimal points, for instance. (But maybe I’m the only one who prefers integers.)

A while back I proposed ‘um’ for micrometres since ‘µm’ could pose problems (encoding and U+00B5 vs. U+03BC). If that’s not small enough for absolute units, add nanometres ‘nm’ while at it (to specify colors by wavelength maybe). We also have plenty of prefixes for larger units, although mega ‘M’ and milli ‘m’ cannot be distinguished in a case-agnostic environment; kilo ‘k’ has already been introduced with hertz ‘Hz’, by the way.

I also intended to suggest a baseline unit (‘u’ for now) which one pixel ‘px’, one point ‘pt’ and one millimetre ‘mm’ (or micrometre) are an integer multiple of. I intended it less as an actual unit authors would use rather than an internal rendering unit, which describes the highest precision authors may expect from user agents. (Ecma 376, OOXML has EMU, I hear, where 3600emu = 1mm, 1270emu = 1pt, 1emu = 0.2_7µm; Tex’s scaled point ‘sp’ is about 5.362851 nm, so roughly 1emu = 51.8sp.)

So, anyhow, what are the real use cases for E notation? Which propreties need values so huge or so tiny?

Received on Friday, 27 August 2010 12:23:17 UTC