Repository navigation
v0.0.48 - Scientific notation
Code and release notes by Claude Opus 5.5 Low Thinking:
Shorter numbers in scientific notation
-
Large and small values use scientific notation when it's shorter. Values with a unit or
%get the shortest form (1000000px→1e6px,-0.000001px→-1e-6px). The digits are handled as text, so very large or very small numbers aren't rounded. -
Unitless
<number>values are shortened too:- in
animation-iteration-count,flex-grow,flex-shrink,tab-sizeand the opacity properties - inside
scale(),scale3d(),scaleX/Y/Z(),matrix()andmatrix3d()
For example,
flex-grow:1000000→flex-grow:1e6. - in
-
Integers are left alone. Values that only accept integers, such as
z-indexand:nth-child()selectors, never get scientific notation, because it would make them invalid. -
Media query ratios are shortened:
(min-aspect-ratio:1000000/1)→(min-aspect-ratio:1e6/1). -
Existing scientific notation is cleaned up: the
eis lowercased, a+on the exponent is dropped, and trailing zeros move into the exponent (1E3px→1e3px,1e+3px→1e3px,10e3px→1e4px).
Better time conversion
- Times are written in whichever of
sandmsis shortest, in either direction.1000000ms→1e3s300000000000000000000000000000ms→3e26s(this used to come out as3e+29ms)0.0001s→.1ms
- Seconds win a tie, so
1234ms→1.234s. 0msstill becomes0s.
Fixes
- Custom properties keep their number type.
--x:100.0is no longer shortened to100. If the property is registered with<integer>syntax, that change would turn an invalid value into a valid one. - A written
+sign is kept. This stops tokens likeU+1F170inunicode-rangefrom being broken when numbers are shortened.